2015-05-22 18:29 GMT-03:00 Paulo César Pereira de Andrade
<paulo.cesar.pereira.de.andr...@gmail.com>:

I believe this patch is better:
ksh-20120801-only-abortsig.patch
---8<---
diff -up ksh-20120801/src/cmd/ksh93/sh/fault.c.orig
ksh-20120801/src/cmd/ksh93/sh/fault.c
--- ksh-20120801/src/cmd/ksh93/sh/fault.c.orig    2015-06-02
13:50:05.511648179 -0300
+++ ksh-20120801/src/cmd/ksh93/sh/fault.c    2015-06-02 13:51:32.573519599 -0300
@@ -645,7 +645,7 @@ void sh_done(void *ptr, register int sig
     sfsync((Sfio_t*)sfstdout);
     if(savxit&SH_EXITSIG)
         sig = savxit&SH_EXITMASK;
-    if(sig)
+    if(sig && abortsig(sig))
     {
         /* generate fault termination code */
         if(RLIMIT_CORE!=RLIMIT_UNKNOWN)
---8<---

> The reproducer would be:
>
> 1. append to /etc/profile:
> trap "kill -2 0" 0
>
> 2. Su a ksh user and exit:
> $ su - user
> $ exit
>
> When exiting, it will return the status of a signal
> to su, that will get confused.
>
> Depending on patchset, or if having su from coreutils
> or util-linux, and/or if this patch is applied:
> http://marc.info/?l=util-linux-ng&m=141184467317500&w=2
> It will print either:
>
> Interrupted (core dumped)
>
> or
>
> Interrupted
>
> On some environments, it may happen that one may
> think it is a good idea to "send a ^C" to the process
> group when an user logs out.

I believe it is better because it would also not print:

Interrupted (core dumped)

or

Interrupted

after:

set -e

and ^C during some command, e.g. a "tree /" or "ls -R /"

Thanks,
Paulo
_______________________________________________
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to