#!/bin/zsh
zmodload zsh/system;
trap "echo Caught $1" $1;
kill -$1 $sysparams[pid];
echo Still alive;
(
kill -$1 $sysparams[pid];
echo Should NOT be reached;
)
% ./bug.zsh HUP
Caught HUP
Still alive
% ./bug.zsh USR1
Caught USR1
Still alive
% ./bug.zsh USR2
Caught USR2
Still alive
Caught USR2
Should NOT be reached
diff --git a/Src/exec.c b/Src/exec.c index 097e0b368..00278ac50 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1089,7 +1089,7 @@ entersubsh(int flags, struct entersubsh_ret *retp) int i, sig, monitor, job_control_ok; if (!(flags & ESUB_KEEPTRAP)) - for (sig = 0; sig < SIGCOUNT; sig++) + for (sig = 0; sig <= SIGCOUNT; sig++) if (!(sigtrapped[sig] & ZSIG_FUNC) && !(isset(POSIXTRAPS) && (sigtrapped[sig] & ZSIG_IGNORED))) unsettrap(sig); @@ -1203,7 +1203,7 @@ entersubsh(int flags, struct entersubsh_ret *retp) * Start loop at 1 because 0 is SIGEXIT */ if (intrap) - for (sig = 1; sig < SIGCOUNT; sig++) + for (sig = 1; sig <= SIGCOUNT; sig++) if (sigtrapped[sig] && sigtrapped[sig] != ZSIG_IGNORED) signal_unblock(signal_mask(sig)); if (!job_control_ok)
Attachment:
bug.zsh
Description: Binary data