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: Linda Walsh
Subject: Re: History file clobbered by multiple simultaneous exits
Date: Thu, 11 Jul 2013 07:05:40 -0700
User-agent: Thunderbird



geoff@cs.hmc.edu 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.



reply via email to

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