Hi,
Here is a patch which aims to address the problem reported earlier:
http://lists.gnu.org/archive/html/bug-bash/2005-07/msg00129.html
by making the signal handler set a flag which is then checked at
strategic points in the main flow of code.
What do you think?
Tim.
*/
--- bash-3.0/sig.c.
I am looking at bash-3.0, trying to untangle the
termination_unwind_protect() signal handler. I cannot work out under
what circumstances the function run_interrupt_trap() is called.
sighandler
termination_unwind_protect (sig)
int sig;
{
if (sig == SIGINT && signal_is_trapped (SIGINT))
Further information on unsafe functions used in signal handlers: a
brief inspection of the code in the termination_unwind_protect()
handler revealed other instances than the one highlighted before:
run_interrupt_trap->_run_trap_internal->savestring->xmalloc
(and more like that)
maybe_save_shell_h
Tim Waugh wrote:
> The signal handler termination_unwind_protect() can call
> maybe_save_shell_history() -> append_history() -> history_do_write()
> -> history_filename() -> xmalloc() -> malloc()
>
> and malloc() is not safe to call from a signal handler. This affects
> bash-2.05b as well as bash
The signal handler termination_unwind_protect() can call
maybe_save_shell_history() -> append_history() -> history_do_write()
-> history_filename() -> xmalloc() -> malloc()
and malloc() is not safe to call from a signal handler. This affects
bash-2.05b as well as bash-3.0.
Tim.
*/ ref 163235
pg