bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Konstantin Andreev
Subject: Re[7]: Subshell exit trap is not invoked if shell exit trap also set
Date: Tue, 26 Mar 2019 22:24:52 +0300
User-agent: Mozilla/5.0 (X11; SunOS i86pc; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

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=1000} ---
| rt_sigreturn({mask=[CHLD]})             = -1 EINTR (Interrupted system call)
| rt_sigprocmask(SIG_BLOCK, NULL, [CHLD], 8) = 0
| getpid()                                = 1436
| write(1, "int exit trap in 1436\n", 22) = 22
| rt_sigaction(SIGTERM, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, 
sa_restorer=0x7f3bbdc8b940}, {sa_handler=0x5644f7bf6f40, sa_mask=[HUP INT ILL 
TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], 
sa_flags=SA_RESTORER, sa_restorer=0x7f3bbdc8b940}, 8) = 0
| getpid()                                = 1436
| kill(1436, SIGTERM)                     = 0
| --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=1436, si_uid=1000} ---
| +++ killed by SIGTERM +++

Centos (not working):

| $ strace -p 90700
| Process 90700 attached
| wait4(-1, 0x7ffd77995430, 0, NULL)      = ? ERESTARTSYS (To be restarted if 
SA_RESTART is set)
| --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=90617, si_uid=1000} ---
| +++ killed by SIGTERM +++

Regards, Konstantin.

Chet Ramey, 26 Mar 2019 21:16 MSK:

Run a system call tracer, I suppose. That will tell you the order in which 
things happen when the processes are traced, at least.

Chet

Konstantin Andreev, 26 Mar 2019 19:44 MSK:

bash-5.0.3,
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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]