Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
The bug from workers/44922 (was: Re: Bug with traps and exit
Good morning Martijn,
Martijn Dekker wrote on Sun, Nov 24, 2019 at 06:54:18 +0100:
> Op 22-01-19 om 00:00 schreef Martijn Dekker:
> > Found a strange issue with traps and 'exit'.
> >
> > Test script:
> >
> > trap 'printf $1; exit; printf $2' USR1
> > fn() {
> > printf 1
> > kill -s usr1 $$
> > printf 2
> > }
> > printf 0
> > fn A B
> > printf 3
> >
> > Every shell outputs 01A, except zsh, which outputs 01A2.
> >
> > This means the execution of the fn() function is not interrupted. The
> > USR1 trap executes 'exit' and does not execute the rest of the trap
> > action, but instead of exiting the shell, zsh continues to execute fn()
> > and then exits.
> >
> > Confirmed down to zsh 5.0.8 (didn't test earlier versions).
>
> A related issue (possibly the same?) with a much simpler test case:
>
> trap 'echo SIGINT; trap - INT; kill -s INT $$; echo woops' INT
> kill -s INT $$
>
> zsh prints 'woops', but shouldn't.
As Peter observed in 45037, could you elaborate on why the inner 'kill' should
abort execution of the trap?
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author