* appendhistory and history file truncation
@ 1995-10-21 7:58 Danek Duvall
1995-10-21 15:27 ` Mark Borges
1995-10-22 10:31 ` Zvi Har'El
0 siblings, 2 replies; 5+ messages in thread
From: Danek Duvall @ 1995-10-21 7:58 UTC (permalink / raw)
To: Zsh users list
I haven't seen this show up on the list, so I thought I'd chime in.
I'm having a problem wherein whenever I start up an invocation of zsh
(2.6 beta10), my history file gets wiped. It doesn't happen when
NO_RCS is set (if I do zsh -f). It seems that even though
APPENDHISTORY is set, savehistfile() ends up opening the file mode
O_TRUNC on line 1471 of hist.c (at least, I think this is the
culprit). Perhaps this line should be rewritten as the block in lines
1420-1423.
I checked beta11-test10, and it hasn't been fixed.
Here's a really straightforward patch to beta10, which *should* fix
the problem, though I haven't tested it. Rewrite as you wish, but I
think this is the right thing to do.
Thanks,
Danek
--- hist.c.orig Sat Oct 21 03:54:08 1995
+++ hist.c Sat Oct 21 03:56:30 1995
@@ -1468,7 +1468,11 @@
histnum++;
}
fclose(out);
- if ((out = fdopen(open(s, O_WRONLY | O_TRUNC, 0600), "w"))) {
+ if (app & 1)
+ out = fdopen(open(s, O_CREAT | O_WRONLY | O_APPEND, 0600), "a");
+ else
+ out = fdopen(open(s, O_CREAT | O_WRONLY | O_TRUNC, 0600), "w");
+ if (out) {
if (histnum < savehist)
for (i = 0; i < histnum; i++)
fprintf(out, "%s", store[i]);
--
Danek Duvall <duvall@lorien.princeton.edu> For my PGP key, send mail with
Computer Science, Princeton University subject "get pgp key" or look
http://lorien.princeton.edu/~duvall/ it up on the keyservers.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: appendhistory and history file truncation
1995-10-21 7:58 appendhistory and history file truncation Danek Duvall
@ 1995-10-21 15:27 ` Mark Borges
1995-10-22 6:14 ` Zvi Har'El
1995-10-22 10:31 ` Zvi Har'El
1 sibling, 1 reply; 5+ messages in thread
From: Mark Borges @ 1995-10-21 15:27 UTC (permalink / raw)
To: duvall; +Cc: zsh-users
>> On Sat, 21 Oct 1995 03:58:32 -0400,
>> Danek Duvall(DD) wrote:
DD> I'm having a problem wherein whenever I start up an invocation of zsh
DD> (2.6 beta10), my history file gets wiped. It doesn't happen when
DD> NO_RCS is set (if I do zsh -f). It seems that even though
DD> APPENDHISTORY is set, savehistfile() ends up opening the file mode
DD> O_TRUNC on line 1471 of hist.c (at least, I think this is the
DD> culprit). Perhaps this line should be rewritten as the block in lines
DD> 1420-1423.
DD> I checked beta11-test10, and it hasn't been fixed.
Zoltan and Peter have sent fixes for this in
archive/latest/373 (also in 337)
archive/latest/376
respectively.
Please try to incorparate these in beta11, Richard. For those of us
who are exec'ing the latest betas out of a startup script it's very
unpleasant to lose your history each time you log in. It's very
difficult to do my real work without history, consequently I haven't
been stress testing the baseline betas since this bug appeared.
-mb-
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: appendhistory and history file truncation
1995-10-21 15:27 ` Mark Borges
@ 1995-10-22 6:14 ` Zvi Har'El
1995-10-22 23:45 ` Zoltan Hidvegi
0 siblings, 1 reply; 5+ messages in thread
From: Zvi Har'El @ 1995-10-22 6:14 UTC (permalink / raw)
To: Mark Borges; +Cc: duvall, zsh-users
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=none, Size: 598 bytes --]
On Sat Oct 21 17:27:24 1995, Mark Borges wrote about ``Re: appendhistory and history file truncation'':
>
> Zoltan and Peter have sent fixes for this in
>
> archive/latest/373 (also in 337)
> archive/latest/376
>
Forgive my ignorance, but which ftp site these refer to?
--
Dr. Zvi Har'El <rl@math.technion.ac.il> Department of Mathematics
+972-4-294094(Phone) Technion - Israel Institute of Technology
+972-4-324654(FAX) http://gauss.technion.ac.il/~rl Haifa 32000, ISRAEL
``If you can't say somethin' nice, don't say nothin' at all.''--Thumper (1942)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: appendhistory and history file truncation
1995-10-22 6:14 ` Zvi Har'El
@ 1995-10-22 23:45 ` Zoltan Hidvegi
0 siblings, 0 replies; 5+ messages in thread
From: Zoltan Hidvegi @ 1995-10-22 23:45 UTC (permalink / raw)
To: rl; +Cc: zsh-users
Zvi Har'El wrote:
> > archive/latest/373 (also in 337)
> > archive/latest/376
> >
> Forgive my ignorance, but which ftp site these refer to?
These are the article numbers in the zsh-workers maining list. To retrieve an
article send a message to zsh-workers-request@math.gatech.edu with archive as
the subject. The message should contain something like
get latest/373
An other note: please get your site administrator configure the elm program
you use. Your message came with this header:
Content-Type: text/plain; charset=none
Content-Transfer-Encoding: 8bit
My elm thinks that this message needs metamail processing. I tried to add
none to compatcharsets but this did not help.
Cheers,
Zoltan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: appendhistory and history file truncation
1995-10-21 7:58 appendhistory and history file truncation Danek Duvall
1995-10-21 15:27 ` Mark Borges
@ 1995-10-22 10:31 ` Zvi Har'El
1 sibling, 0 replies; 5+ messages in thread
From: Zvi Har'El @ 1995-10-22 10:31 UTC (permalink / raw)
To: Danek Duvall; +Cc: zsh-users
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=none, Size: 2116 bytes --]
On Sat Oct 21 09:58:32 1995, Danek Duvall wrote about ``appendhistory and history file truncation'':
>
> I haven't seen this show up on the list, so I thought I'd chime in.
>
> I'm having a problem wherein whenever I start up an invocation of zsh
> (2.6 beta10), my history file gets wiped. It doesn't happen when
> NO_RCS is set (if I do zsh -f). It seems that even though
> APPENDHISTORY is set, savehistfile() ends up opening the file mode
> O_TRUNC on line 1471 of hist.c (at least, I think this is the
> culprit). Perhaps this line should be rewritten as the block in lines
> 1420-1423.
>
> I checked beta11-test10, and it hasn't been fixed.
>
> Here's a really straightforward patch to beta10, which *should* fix
> the problem, though I haven't tested it. Rewrite as you wish, but I
> think this is the right thing to do.
>
> Thanks,
> Danek
>
> --- hist.c.orig Sat Oct 21 03:54:08 1995
> +++ hist.c Sat Oct 21 03:56:30 1995
> @@ -1468,7 +1468,11 @@
> histnum++;
> }
> fclose(out);
> - if ((out = fdopen(open(s, O_WRONLY | O_TRUNC, 0600), "w"))) {
> + if (app & 1)
> + out = fdopen(open(s, O_CREAT | O_WRONLY | O_APPEND, 0600), "a");
> + else
> + out = fdopen(open(s, O_CREAT | O_WRONLY | O_TRUNC, 0600), "w");
> + if (out) {
> if (histnum < savehist)
> for (i = 0; i < histnum; i++)
> fprintf(out, "%s", store[i]);
>
> --
> Danek Duvall <duvall@lorien.princeton.edu> For my PGP key, send mail with
> Computer Science, Princeton University subject "get pgp key" or look
> http://lorien.princeton.edu/~duvall/ it up on the keyservers.
>
>
>
As far as I have been able to verify, this works for non-login shells. However,
if I log out and then login again, the problem persists even after applying the
patch.
--
Dr. Zvi Har'El <rl@math.technion.ac.il> Department of Mathematics
+972-4-294094(Phone) Technion - Israel Institute of Technology
+972-4-324654(FAX) http://gauss.technion.ac.il/~rl Haifa 32000, ISRAEL
``If you can't say somethin' nice, don't say nothin' at all.''--Thumper (1942)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1995-10-22 23:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-10-21 7:58 appendhistory and history file truncation Danek Duvall
1995-10-21 15:27 ` Mark Borges
1995-10-22 6:14 ` Zvi Har'El
1995-10-22 23:45 ` Zoltan Hidvegi
1995-10-22 10:31 ` Zvi Har'El
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).