Re[9]: Subshell exit trap is not invoked if shell exit trap also set

2019-03-27 Thread Konstantin Andreev
Al, thank you for your time. Being under the impression of your experiment, I went back to my setup, looked at it thoughtfully for a while, and realized that bash-5.* ... if fact works. There was a unfortunate mistake of mine: I launched [ssxtrap] from inside interactive bash-5, but ... as [./

Re: Re[7]: Subshell exit trap is not invoked if shell exit trap also set

2019-03-26 Thread Al Payne
Konstantin, I also tried to replicate on CentOS (under Fusion), but get the two expected trap messages when killing the internal process: ext pid=25449 int pid=25450 int exit trap in 25450 subshell done ext exit trap in 25449 Test install: - CentOS Linux release 7.2.1511 (Cor

Re[7]: Subshell exit trap is not invoked if shell exit trap also set

2019-03-26 Thread Konstantin Andreev
As you decide. Debian (working), subshell syscall trace on receiving sigterm: | $ strace -p 1436 | strace: Process 1436 attached | wait4(-1, 0x7ffd49d66b90, 0, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set) | --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=1461, si_uid

Re: Subshell exit trap is not invoked if shell exit trap also set

2019-03-26 Thread Chet Ramey
On 3/26/19 12:44 PM, Konstantin Andreev wrote: > 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) >    

Re[5]: Subshell exit trap is not invoked if shell exit trap also set

2019-03-26 Thread Konstantin Andreev
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 M

Re[3]: Subshell exit trap is not invoked if shell exit trap also set

2019-03-26 Thread Konstantin Andreev
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.15

Re: Subshell exit trap is not invoked if shell exit trap also set

2019-03-26 Thread Dmitry Goncharov
On Mon, Mar 25, 2019 at 6:24 PM Konstantin Andreev wrote: > Verified on: > > Solaris 11.3, bash 4.1.17(1)-release (i386-pc-solaris2.11) > CentOS Linux 7.2.1511, bash 4.2.46(1)-release (x86_64-redhat-linux-gnu) > CentOS Linux 7.2.1511, bash 5.0.0(1)-release (x86_64-pc-linux-gnu) Dou

Re: Subshell exit trap is not invoked if shell exit trap also set

2019-03-26 Thread Chet Ramey
On 3/25/19 3:48 PM, Konstantin Andreev wrote: > 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 9) & > | > | wait

Subshell exit trap is not invoked if shell exit trap also set

2019-03-25 Thread Konstantin Andreev
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 9) & | | wait | echo "subshell done" Let's run it: Terminal A