Discussion:
[ast-users] ksh non posix functions behavior change
Paulo César Pereira de Andrade
2017-05-30 15:56:03 UTC
Permalink
Hi,

I have a ksh user that relied on previous behaviour of ksh (not posix)
functions trap handling.

The change in question is src/cmd/ksh93/sh/xec.c:sh_funscope()
that now only "forwards" a signal for SIGINT and SIGQUIT.

if (r>SH_EXITSIG && ((r&SH_EXITMASK)==SIGINT || r&SH_EXITMASK)==SIGQUIT)
kill(getpid(),r&SH_EXIMASK);

previously it would call sh_fault() on any signal.

I see the patch is explicit, but I fail to understand the reason of the
behavior change, e.g. if executing nested non posix functions, and
a non posix function traps signals, it now may ignore signals that by
default would have terminated the script/execution.

One example is the attached script. Note that fixing the test case
is trivial. The issue is the user relying on previous behavior.

Thanks,
Paulo
Peter Hitchman
2017-11-20 13:10:35 UTC
Permalink
I think it is fair to say now that question about ksh93 should be directed
as issues to https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_att_ast&d=DwIFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=xAmMDCZ2-8GzvOGVQ4JNytGtSvYfbcWh1NmETt0f950&m=h2-MigarEvN2r2UwdifJTmwcySbxlyFeeTqqUVAZo0A&s=gW7cr036OxT6ysbi7b3zGzUYQUnk0gXJRrqjp69TUKo&e= .
Any other comments?
Very little traffic here now.

Regards
Pete
Post by Paulo César Pereira de Andrade
Hi,
I have a ksh user that relied on previous behaviour of ksh (not posix)
functions trap handling.
The change in question is src/cmd/ksh93/sh/xec.c:sh_funscope()
that now only "forwards" a signal for SIGINT and SIGQUIT.
if (r>SH_EXITSIG && ((r&SH_EXITMASK)==SIGINT ||
r&SH_EXITMASK)==SIGQUIT)
kill(getpid(),r&SH_EXIMASK);
previously it would call sh_fault() on any signal.
I see the patch is explicit, but I fail to understand the reason of the
behavior change, e.g. if executing nested non posix functions, and
a non posix function traps signals, it now may ignore signals that by
default would have terminated the script/execution.
One example is the attached script. Note that fixing the test case
is trivial. The issue is the user relying on previous behavior.
Thanks,
Paulo
_______________________________________________
ast-users mailing list
http://lists.research.att.com/mailman/listinfo/ast-users
Loading...