exit-ing in a trap handler uses the wrong exit code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



        Hi there

 qemu's configure uses a trap handler which calls exit; configure would
 call exit 1, but with the trap handler in place the configure script
 would return with exit 0.

 dash -c 'trap "sh -c \"exit 4\"; exit" 0 1 2 3 9 11 13 15;exit 3'; echo $?
 4

 Blue Swirl on the qemu-devel list points out that according to POSIX
 this should be 3:
 http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_21

 bash and zsh get this right:
 bash -c 'trap "sh -c \"exit 4\"; exit" 0 1 2 3 9 11 13 15;exit 3'; echo $?
 3

 I've logged https://bugs.launchpad.net/ubuntu/+source/dash/+bug/647450
 to track this as I'm seeing this with the Ubuntu version of dash.

   Cheers,

NB: Not subscribed to the list, please Cc: me on replies
-- 
Loïc Minier
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux