Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15513
| From | Isaac To <isaac.to@gmail.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Signal ignore flags unexpectedly reset after "trap ... EXIT" |
| Date | 2019-10-15 17:22 +0800 |
| Message-ID | <mailman.776.1571143362.9715.bug-bash@gnu.org> (permalink) |
| References | <CAOArY3X4VXAkmoCh0vsRZuHsJpw=jOF4_uLocsap1bG+QpK1iQ@mail.gmail.com> |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-LQgi2O/bash-5.0=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux superposition 5.0.0-25-generic #26-Ubuntu SMP Thu Aug 1
12:04:58 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 3
Release Status: release
Description:
When trying to write a program and start it in an initrc script, I observed
a strange behavior: if a subshell is started by a subshell of that script,
and the inner subshell runs "trap ... EXIT", it unsets the signal ignore
flag of other signals. I'm not sure whether this should be called a bug,
or whether it is a problem caused by my own configuration. Anyway here is
how I reproduce my problem.
Repeat-By:
$ cat t.sh
echo t $BASHPID
trap '' USR1
grep SigIgn /proc/$BASHPID/status
bash --rcfile t2.sh
$ cat t2.sh
echo t2 $BASHPID
grep SigIgn /proc/$BASHPID/status
(
echo subshell $BASHPID
grep SigIgn /proc/$BASHPID/status
(
echo subsubshell $BASHPID
grep SigIgn /proc/$BASHPID/status
echo trap $BASHPID
trap 'echo hello' EXIT
grep SigIgn /proc/$BASHPID/status
)
)
$ ./t.sh
t 15141
SigIgn: 0000000000000204
t2 15143
SigIgn: 0000000000380004
subshell 15145
SigIgn: 0000000000000200
subsubshell 15147
SigIgn: 0000000000000200
trap 15147
SigIgn: 0000000000000000
hello
$
Note that the final SigIgn flag is completely reset, which is what I won't
expect. The same problem won't occur if --rcfile is not used in t.sh. And
the problem also didn't show up in bash 4.4.
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Signal ignore flags unexpectedly reset after "trap ... EXIT" Isaac To <isaac.to@gmail.com> - 2019-10-15 17:22 +0800
csiph-web