btw, I can undertake some debugging, but I have no time to investigate how the bash code works.
If you may provide me with enough details so that I would know where to look into the control flow, I would investigate what's happening. Regards, Konstantin Konstantin Andreev, 26 Mar 2019 19:44 MSK:
Just built and tested it. The systems are x86-64. + Debian GNU/Linux buster/sid (pre-10): works (both exit traps are invoked) - CentOS Linux 7.2.1511: NOT work (subshell exit trap is NOT invoked) - Oracle Solaris 11.3: NOT work (subshell exit trap is NOT invoked) What can I do to help you isolate this issue?
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:
[ ... skip ...] 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.