Le 14/03/2013 21:18, Alan Somers a écrit :
I noticed that when a command run by ksh93 is killed by SIGABRT, it
returns an exit status of 262.  This is contrary to the behavior of
dash, bash, zsh, csh, tcsh, and mksh, which all return 134.  It also
seems contrary to the sus, which specifies that "the special parameter
'?', the shell shall report the full eight bits of exit status
available".  Is this a bug or is the behavior intentional?  I tested it
on FreeBSD 9.1 and Ubuntu 11.10, both on amd64.

# /bin/sleep 20    # From another terminal, type "kill -6 the_pid_of_sleep"
Abort(coredump)
# echo $?
262
# ksh93 --version
   version         sh (AT&T Research) 93u+ 2012-08-01

http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_08_02

this shouldn't be a problem since this is a documented feature.
however, this may be a problem in a mixed shell environment.

$ echo $BASH_VERSION
4.1.10(4)-release

$ /opt/ast/bin/ksh --version
  version         sh (AT&T Research) 93u+ 2012-02-14

$ /opt/ast/bin/ksh

$ sleep 30 &
[1]     14912

$ kill -ABRT $!

$ wait $!
Abort

$ echo $?
262

$ exit

$ /opt/ast/bin/ksh -c 'sleep 60'&
[1] 15764

$ kill -ABRT $!

$ wait $!
[1]+  Aborted                 /opt/ast/bin/ksh -c 'sleep 60'

$ echo $?
134

but, if you know you are using ksh93, check for > 255 value and > 128 if not...

Regards,

Cyrille Lefevre
--
mailto:[email protected]

_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to