Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 3.1.6-pws-1: Cannot exit zsh if history file is unwritable



Andrej Borsenkow wrote:

> bor@itsrm2:~%> sudo -u nerv -s
> nerv@itsrm2:~%> cd
> zsh: can't write history file /home/bor/.zsh_history
> nerv@itsrm2:~%> exit
> zsh: can't write history file /home/bor/.zsh_history
> 
> It is no more possible to execute any single command.
> 
> nerv@itsrm2:~%> logout
> zsh: can't write history file /home/bor/.zsh_history
> nerv@itsrm2:~%> tty
> zsh: can't write history file /home/bor/.zsh_history

This is the simplest fix. Note that this means that you don't get the
warning message on each command any more, but you get it when exiting
the shell (but you *can* exit it).

Maybe this different second argument (named `err' and indicating that
errors should be raised in `savehistfile()') was even intended to be
zero in that call -- otherwise it would be `1' in all calls, which
seems strange.

Bye
 Sven

--- os/hist.c	Mon Aug 30 11:57:55 1999
+++ Src/hist.c	Mon Aug 30 14:45:47 1999
@@ -1043,7 +1043,7 @@
     chline = NULL;
     histactive = 0;
     if (isset(SHAREHISTORY) || isset(INCAPPENDHISTORY))
-	savehistfile(hf, 1, HFILE_USE_OPTIONS | HFILE_FAST);
+	savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST);
     unlockhistfile(hf); /* It's OK to call this even if we aren't locked */
     return !(flag & HISTFLAG_NOEXEC || errflag);
 }

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author