Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: x86_64-pc-linux-gnu-gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -march=k8 -pipe -O2 -msse3 uname output: Linux tux 2.6.22-gentoo-r5 #1 Mon Aug 27 18:24:02 CEST 2007 x86_64 AMD Sempron(tm) Processor 3300+ AuthenticAMD GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 3.2 Patch Level: 17 Release Status: release Description: >From man bash: Non-builtin commands run by bash have signal handlers set to the values inherited by the shell from its parent. When job control is not in effect, asynchronous commands ignore SIGINT and SIGQUIT in addition to these inherited handlers. Commands run as a result of command substitution ignore the keyboard-generated job control signals SIGTTIN, SIGTTOU, and SIGTSTP. This doesn't seem to be the case. When job control is not in effect, async jobs still get SIGINT sent to them even if SIGINT is sent to the main process. As far as I can see I should get "After quit" printed out and netcat should not have died before the trap got run. After asking for this in #bash on irc.freenode.net <@greycat> The man page says "When job control is not in effect, asynchronous commands ignore SIGINT and SIGQUIT as well." <@greycat> My initial testing with #!/bin/bash set +m nc gateway 25 & wait Doesn't work, though. Ctrl-C kills both. I also got told I should report a bug using bashbug. Repeat-By: $ cat > test.sh #!/bin/bash set +m trap 'echo got INT; ps aux | grep "$PID"; echo QUIT >&3; echo After quit' INT mkfifo /tmp/in mkfifo /tmp/out nc irc.kuonet-ng.org 6667 < /tmp/out > /tmp/in & PID="$!" exec 3>/tmp/out exec 4</tmp/in wait $ bash test.sh got INT anmaster 10438 0.0 0.0 2780 576 pts/8 R+ 21:36 0:00 grep 10436