Re : Re: [Résolu] Pas d'historique de zsh en root

2023-06-23 Par sujet benoit
Le vendredi 23 juin 2023 à 11:24, Marc Chantreux  a écrit :


> salut,
> 
> > Enfin tant que ça marche...
> 
> 
> idéalement il faudrait comprendre pourquoi mais là j'ai vraiment pas le
> temps :(
> 

C'est déjà bien sympa de m'avoir filé ta config... :-)

Ma confusion vient du fait que j'ai crus (à tors, je viens de vérifier, ce 
n'est pas dit dans le manuel) que l'option APPEND_HISTORY est l'option par 
défaut avec HISTFILE=nom_fichier. 

Mais c'est faux, voici l'info exacte :


INC_APPEND_HISTORY 

This option works like APPEND_HISTORY except that new history lines are 
added to the $HISTFILE incrementally (as soon as they are entered), rather than 
waiting until the shell exits. The file will still be periodically re-written 
to trim it when the number of lines grows 20% beyond the value specified by 
$SAVEHIST (see also the HIST_SAVE_BY_COPY option). 

APPEND_HISTORY  

If this is set, zsh sessions will append their history list to the history 
file, rather than replace it. Thus, multiple parallel zsh sessions will all 
have the new entries from their history lists added to the history file, in the 
order that they exit. The file will still be periodically re-written to trim it 
when the number of lines grows 20% beyond the value specified by $SAVEHIST (see 
also the HIST_SAVE_BY_COPY option). 

Du coup je n'ai pas gardé l'option :
EXTENDED_HISTORY 

Save each command’s beginning timestamp (in seconds since the epoch) and 
the duration (in seconds) to the history file. The format of this prefixed data 
is:

‘: :;’. 

Pas besoin de dater, surtout si c'est humainement lisible

HIST_FIND_NO_DUPS
When searching for history entries in the line editor, do not display 
duplicates of a line previously found, even if the duplicates are not 
contiguous. 

Me semble redondant avec HIST_IGNORE_ALL_DUPS qui en cas de doublon supprime 
l'existant et ne garde que le nouveau, du coup il ne saurait pas trouver de 
doublon.


Cf.
https://zsh.sourceforge.io/Doc/Release/Options.html




Re: [Résolu] Pas d'historique de zsh en root

2023-06-23 Par sujet Marc Chantreux
salut,

> Enfin tant que ça marche...

idéalement il faudrait comprendre pourquoi mais là j'ai vraiment pas le
temps :(

a+
marc



[Résolu] Pas d'historique de zsh en root

2023-06-23 Par sujet benoit


Le vendredi 23 juin 2023 à 10:44, benoit  a écrit :


> Le vendredi 23 juin 2023 à 09:54, Marc Chantreux m...@unistra.fr a écrit :
> 
> 
> 
> > salut,
> > 
> > Le Fri, Jun 23, 2023 at 06:17:03AM +, benoit a écrit :
> > 
> > > Voici mon .zshrc
> > > Pourquoi est-ce que je n'ai pas d'historique en root ?
> > 
> > pas le temps de plonger dans la doc mais je viens de tester
> > ma conf:
> > 
> > HISTSIZE=5000 HISTFILE=~/zsh/history SAVEHIST=5000
> > # setopt share_history
> 
> 
> Bonjour oui ça marche tout à fait suffisant...
> Mais c'est probablement à cause de ce qui suit :
> Pare que le nom du fichier HISTFILE=~/zsh/history
> ou .zsh_history
> ou .sh_history
> Pour autant que le nom corresponde dans le .zshrc...
> 
> Du coup ça doit être ici que ça se passe :
> 
Je les ai commenté et ça marche plus 

> > setopt INC_APPEND_HISTORY
> > setopt EXTENDED_HISTORY
> > setopt HIST_IGNORE_SPACE
> > setopt HIST_IGNORE_ALL_DUPS
> > setopt HIST_FIND_NO_DUPS
> > setopt HIST_SAVE_NO_DUPS
> > 

C'est "setopt INC_APPEND_HISTORY" qui fait que ça marche, mais je ne l'ai pas, 
dans le .zshrc de mon utilisateur normal...
Enfin tant que ça marche...

Merci pour ton aide

--
Benoît

> > je passe root avec doas zsh et ça fonctionne.
> > 
> > est-ce suffisant?