Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
bug: can't write history file
- X-seq: zsh-workers 22900
- From: Dmitry Karasik <dmitry@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: bug: can't write history file
- Date: Tue, 24 Oct 2006 16:17:40 +0200
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Reply-to: dmitry@xxxxxxxxxxxxxx
Hello,
After upgrading to 4.3.2, I've found that one of the features I love in zsh is
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:
--- hist.c.orig Tue Oct 24 15:45:28 2006
+++ hist.c Tue Oct 24 15:45:47 2006
@@ -2163,7 +2163,7 @@
readhistfile(fn, err, 0);
hist_ignore_all_dups = isset(HISTIGNOREALLDUPS);
if (histlinect)
- savehistfile(fn, err, 0);
+ savehistfile(fn, err, writeflags & HFILE_APPEND);
pophiststack();
histactive = remember_histactive;
--
Sincerely,
Dmitry Karasik
Messages sorted by:
Reverse Date,
Date,
Thread,
Author