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.
The attached patch corrects the condition on ksh.
Thanks,
Paulo
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-05-22 18:03:31.970418794 -0300
+++ ksh-20120801/src/cmd/ksh93/sh/fault.c 2015-05-22 18:03:36.579413302 -0300
@@ -582,8 +582,17 @@ void sh_exit(register int xno)
#endif /* SHOPT_TYPEDEF*/
if(job.in_critical)
job_unlock();
- if(pp->mode == SH_JMPSCRIPT && !pp->prev)
- sh_done(shp,sig);
+ if(pp->mode == SH_JMPSCRIPT && !pp->prev)
+ {
+ if(!indone || abortsig(sig))
+ sh_done(shp,sig);
+ /* sh_done does not return, just for readability */
+ else
+ {
+ shp->exitval = 0;
+ sh_done(shp,0);
+ }
+ }
if(pp->mode)
siglongjmp(pp->buff,pp->mode);
}
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users