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: Dr. Werner Fink
Subject: Re: [bash-bug] no local bash_history created or written to if existing (~/.bash_history
Date: Tue, 8 Mar 2011 17:51:37 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Mar 08, 2011 at 11:19:25AM -0500, Chet Ramey wrote:
> 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.

Does this mean that the attached patch could also not work
on some systems? Or does this interfere with the readline
library?

That would be a problem as I'm pretty sure that most users
will see this a major bug.  Even sysadmins will open a bug
as a simple shutdown will miss their last few command lines.


   Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

Attachment: x
Description: Text Data


reply via email to

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