[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
INT still propagating to child processes when trapped
From: |
Daniel Mills |
Subject: |
INT still propagating to child processes when trapped |
Date: |
Tue, 10 Jul 2018 22:59:16 -0400 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_FORTIFY_SOURCE=2
-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc'
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS
-Wno-parentheses -Wno-format-security
uname output: Linux djdev 4.17.5-1-ARCH #1 SMP PREEMPT Sun Jul 8 17:27:31
UTC 2018 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu
Bash Version: 4.4
Patch Level: 23
Release Status: release
Description:
After an INT trap, forked processes are still sent INT when ^C is used on
a running script.
Repeat-By:
#!/bin/bash
{
trap 'echo "foo :("' EXIT
sleep 30
echo foo
} & foo=$!
{
trap 'echo "bar :("' EXIT
sleep 32
echo bar
} & bar=$!
trap 'kill "$foo"' INT
read
sleep 60
###################################
Run this script in bash 3.x and hit ^C, and you get "foo :(", as expected.
Run it with bash 4.4, and you also get "bar :(". I would not expect this.
- INT still propagating to child processes when trapped,
Daniel Mills <=