[Bug 189] ash behaves strangely on CTRL-C (does not exit but fills process table)

bugzilla at busybox.net bugzilla at busybox.net
Thu Mar 19 03:30:56 UTC 2009


https://bugs.busybox.net/show_bug.cgi?id=189





--- Comment #7 from Denys Vlasenko <vda.linux at googlemail.com>  2009-03-19 03:30:55 UTC ---
I think it needs to be made like this:

        gotsig[signo - 1] = 1;
//      pendingsig = signo;

        if (/* exsig || */ (signo == SIGINT && !trap[SIGINT])) {
                if (!suppressint) {
                        pendingsig = 0;
                        raise_interrupt(); /* does not return */
                }
                intpending = 1;
        } else
                pendingsig = signo;

IOW, pendingsig is 1 if signal OTHER than SIGINT is pending, and intpending is
for SIGINT. Currently, it looks like pendingsig will be set for SIGINT too, and
then SIGINT handling sees that and handles SIGINT again as if it is an "other"
signal.

Your proposal "if (!intpending) pendingsig = signo;" will make pending SIGINT
ignore any other signal.

> need to add "pendingsig = 0;" outside of the inner if statement, to catch the case that pendingsig is 1 already and a SIGINT occurs when INTs are supposed to be suppressed.

But that is a valid scenario. Other signal occurred, then user pressed ^C.
Shall we forget about "other signal"? I don't think so.


Please let me know how the above fix works for you. It seems to work for me
(and yes, I managed to reproduce the bug)


-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list