zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.dk, Vincent Lefevre <vincent@vinc17.org>
Subject: Re: [4.0.2 bug] commands not written to history
Date: Sat, 21 Jul 2001 18:32:20 +0000	[thread overview]
Message-ID: <1010721183220.ZM8456@candle.brasslantern.com> (raw)
In-Reply-To: <20010721154449.A1971@ay.free.fr>

[Moved to zsh-workers]

On Jul 21,  3:44pm, Vincent Lefevre wrote:
} Subject: Re: [4.0.2 bug] commands not written to history
}
} This problem occurred again, but this time with a local FS [...]
} Moreover, the command I got after cmd1 was "startx", which means that
} cmd2 (the command that hadn't been written to the history) was the
} last command typed in the shell, like in my previous bug report.

Something that just occurred to me:  You're sure that `cmd2' has run to
completion and the prompt has returned before the shell where you typed
that command exited?  E.g. you didn't type `cmd2' and then while it was
still running, shut down your X server or kill the xterm window?

Here's what you should try next:

Make a directory ~/zhist-debug (call it whatever you like).

Put in your .zshrc the commands:

	date > ~/zhist-debug/startup.$$
	TRAPEXIT() {
	  # Order here is important!
	  fc -WI ~/zhist-debug/unsaved.$$
	  fc -W ~/zhist-debug/complete.$$
	  # This assumes you have GNU `cp'
	  cp -p $HISTFILE ~/zhist-debug/histfile.$$
	}

If there is a `startup' file with none of the other files, then zsh may be
exiting without writing the history at all, which shouldn't matter with
INC_APPEND_HISTORY but might be a clue all the same.

Because zsh writes the history before calling TRAPEXIT, the `unsaved' file
should always be empty.  If it is not, then INC_APPEND_HISTORY is causing
an error when the history is written at exit time.

For the same reason, the modify time of the `histfile' file (copied from
$HISTFILE by `cp -p') should be EARLIER THAN the modify time of the
`complete' file.  If it isn't, then multiple shells are writing to the
histfile almost simultaneously (e.g., because you killed your entire X
session rather than exiting from each individual shell), so zsh may have
a locking problem.  (Note that if you exit from a lot of shells at once,
even if locking is working properly the order in which $HISTFILE gets
updated will be essentially random; obtaining the lock is a race.)

My guess is that `startx' is being inserted into $HISTFILE by your console
login shell at the time the `startx' command finishes, i.e., after all the
xterm shells have shut down.  So none of the `histfile' files except the
one for the console shell should have the `startx' command at the end.  If
`startx' appears near the end of more than one of those files, then the
problem may be that the console shell is incrementally appending `startx'
to $HISTFILE before all the exiting xterm shells have finished saving their
own commands, thus garbling the expected ordering.

If none of these races happened, then the `complete' file should have the
same last $HISTSIZE entries (assuming SAVEHIST > HISTSIZE) as the `histfile'
file, possibly modulo incrementally saved entries from other shells which
may have been in $HISTFILE.  Any unexplained differences may give us a clue.

Finally, by examining the file times of the various files we can tell in
what order the shells are starting and exiting, which may help determine
what sequence of events causes the error.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


       reply	other threads:[~2001-07-21 18:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20010629163348.A9632@greux.loria.fr>
     [not found] ` <20010721154449.A1971@ay.free.fr>
2001-07-21 18:32   ` Bart Schaefer [this message]
2001-07-21 23:43     ` Vincent Lefevre
2001-07-22  3:41       ` Bart Schaefer
2001-07-22 11:11         ` Vincent Lefevre
2001-07-22 13:39         ` Vincent Lefevre
2001-07-22 13:49           ` Vincent Lefevre
2001-07-22 15:33     ` Vincent Lefevre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010721183220.ZM8456@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=vincent@vinc17.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).