[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[3]: Subshell exit trap is not invoked if shell exit trap also set
From: |
Konstantin Andreev |
Subject: |
Re[3]: Subshell exit trap is not invoked if shell exit trap also set |
Date: |
Tue, 26 Mar 2019 19:44:09 +0300 |
User-agent: |
Mozilla/5.0 (X11; SunOS i86pc; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
bash-5.0.3, - is it what is marked [Bash-5.0 patch 3: improve...] in bash.git?
Just built and tested it. The systems are x86-64.
+ Debian GNU/Linux buster/sid (pre-10): works (both exit traps are invoked)
(runs in virtual machine)
kernel-4.18.0-3-amd64, glibc-2.28-6
- CentOS Linux 7.2.1511: NOT work (subshell exit trap is NOT invoked)
(runs on real hardware)
kernel-3.10.0-327.36.3.el7.x86_64, glibc-2.17
- Oracle Solaris 11.3: NOT work (subshell exit trap is NOT invoked)
(runs on real hardware)
system/kernel/platform 0.5.11-0.175.3.1.0.4.0
system/library 0.5.11-0.175.3.1.0.3.0
What can I do to help you isolate this issue?
Best regards,
Konstantin Andreev
Chet Ramey, 26 Mar 2019 16:57 MSK:
I can't reproduce this using RHEL 7 or Mac OS X using bash-5.0.3.
Konstantin Andreev, 25 Mar 2019 22:48 MSK:
Consider the simple `ssxtrap' script:
| #!/bin/bash
|
| echo ext pid=$BASHPID
| # trap 'echo "ext exit trap in $BASHPID"' EXIT
|
| (echo int pid=$BASHPID
| trap 'echo "int exit trap in $BASHPID"' EXIT
| sleep 99999) &
|
| wait
| echo "subshell done"
[ ... skip ... ]
... but if I uncomment the line that installs exit trap in the main shell, the
output changes to:
Terminal A Terminal B
---------- -----------
| $ ./ssxtrap
| ext pid=10373
| int pid=10374
| $ kill 10374
| ./ssxtrap: line 10: 10374 Terminated ...
| subshell done
| ext exit trap in 10373
i.e. subshell exit trap is not invoked anymore.
Since subshell exit trap shall not depend from main shell exit trap, this
behaviour looks like a bug for me.
- Subshell exit trap is not invoked if shell exit trap also set, Konstantin Andreev, 2019/03/25
- Re: Subshell exit trap is not invoked if shell exit trap also set, Chet Ramey, 2019/03/26
- Re[3]: Subshell exit trap is not invoked if shell exit trap also set,
Konstantin Andreev <=
- Re[5]: Subshell exit trap is not invoked if shell exit trap also set, Konstantin Andreev, 2019/03/26
- Re: Subshell exit trap is not invoked if shell exit trap also set, Chet Ramey, 2019/03/26
- Re[7]: Subshell exit trap is not invoked if shell exit trap also set, Konstantin Andreev, 2019/03/26
- Re: Re[7]: Subshell exit trap is not invoked if shell exit trap also set, Al Payne, 2019/03/26
- Re[9]: Subshell exit trap is not invoked if shell exit trap also set, Konstantin Andreev, 2019/03/27
Re: Subshell exit trap is not invoked if shell exit trap also set, Dmitry Goncharov, 2019/03/26