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 c...@case.edu http://cnswww.cns.cwru.edu/~chet/