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

Re: bug: can't write history file

Dmitry Karasik wrote:
> Hello,
> After upgrading to 4.3.2, I've found that one of the features I love in zsh i
> s
> broken, namely the possibility to use the history file for both root and
> non-root sessions.  Now, after I logout from "sudo zsh", I get this:
>    zsh: can't write history file /home/dk/.zsh-history
> I found that it is savehistfile() to blame, because it apparently is called
> with writeflags=0, which bypasses all append/rewrite logic, falling back to
> saving the file by renaming it to .zsh-history.new, and (correctly) refusing 
> to
> overwrite .zsh-history because the euid is different. If I'm correct in
> this, the patch below fixes the problem:
> -               savehistfile(fn, err, 0);
> +               savehistfile(fn, err, writeflags & HFILE_APPEND);

That line is the same in 4.2, so I presume what has changed is the
default options (how it reaches this code).  In that case it's
plausible that this should always have had that flag.  It would
be best if Wayne could comment about what he thinks did change,
but I'm not sure if he's around at the moment.

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

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