bug-bash
[Top][All Lists]
Advanced

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

Re: [bash-bug] no local bash_history created or written to if existing (


From: Chet Ramey
Subject: Re: [bash-bug] no local bash_history created or written to if existing (~/.bash_history
Date: Tue, 08 Mar 2011 11:19:25 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

On 3/8/11 5:29 AM, Dr. Werner Fink wrote:

>> One thing that has changed is that an interactive shell will no longer
>> attempt to write the history file if it's killed by a signal, since that
>> causes many functions to be executed that are not safe to call from a
>> signal handler.  If you're in the habit of trying to exit the shell by
>> closing the terminal window, which causes the shell to be killed by SIGHUP
>> (I think, maybe SIGTERM), the history will not be saved.
> 
> That will cause a lot of bugreports.  Just a question: could an atexit()
> handler an option or an other way the bash could make use use an extra
> (sig)longjmp()/(sig)setjmp() after increasing an atomic control variable
> in the signal handlers for SIGHUP/SIGTERM to run all things done short
> before exit.

The signal handling is already split up between a handler and a function
that does the processing when it's `safe'.  The problem is that there are
some signals that have to be handled immediately because it's really not
possible to continue after receiving them (e.g., SIGSEGV), and some cases
where you have to handle the signal immediately because you're not in a
position to wait until a safe time (e.g., when reading input from the
terminal using read(2)).  This is the latter case.

I might be able to finesse this particular case based on the state that
readline exports to the calling application.  Another option is to take
advantage of the fact that bash installs the SIGHUP handler without the
SA_RESTART flag, but that requires more extensive changes.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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