bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: History file clobbered by multiple simultaneous exits


From: Geoff Kuenning
Subject: Re: History file clobbered by multiple simultaneous exits
Date: Wed, 17 Jul 2013 16:03:44 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

> address@hidden wrote:
>>      Locking should be used when truncating and writing the history
>>      file.  (Yes, I know it's a pain in a portable program like
>>      bash.)
>>
>>      Strictly speaking, locking is only half a solution, because
>>      the net result will be that the saved history is taken from
>>      a randomly chosen one of the multiple exiting shells.  But
>>      that's better than the current situation where all history is lost.
>>
>>      What might be cooler would be to merge all the history lines
>>      from all shells, in timestamp order.  But given the current
>>      history file format, that seems...hard.
> ----
> You shouldn't write to the same history file from multiple
> sessions.  Encode the session name (or ttyname) in the history file name
> Then they won't collide as you can only have 1 person logged in / tty.

Sigh.

Bug reporter: "Program X doesn't work correctly when used in perfectly
reasonable fashion Y--which happens to be the default."

Maintainer: "You shouldn't do Y.  I don't do Y, therefore nobody else
should do Y either, they should go out of their way and do Z instead.  I
don't want to fix the incorrect behavior even though it can happen in
many situations."

It's normal to open multiple windows.  By default, bash writes to
~/.history.  Furthermore, for perfectly good reasons I want all my
sessions to write to--and more importantly, to read from--the same
history file.

And in this the case the suggested workaround is loaded with flaws.  For
example, it's quite easy to be logged in to the same filesystem multiple
times under the same tty name.  (Think NFS.)

The correct response to a valid bug report isn't "go away and change
your behavior."  It's to fix the bug.
-- 
    Geoff Kuenning   address@hidden   http://www.cs.hmc.edu/~geoff/

McDonald's, which does not wait on your table, does not cook your food
to order, and does not clear your table, came up with the slogan ``We
Do It All For You.''
        -- Dave Barry



reply via email to

[Prev in Thread] Current Thread [Next in Thread]