DASH Shell discussions
 help / color / mirror / Atom feed
* exit-ing in a trap handler uses the wrong exit code
@ 2010-09-25 11:59 Loïc Minier
  2010-09-25 20:34 ` Jilles Tjoelker
  0 siblings, 1 reply; 3+ messages in thread
From: Loïc Minier @ 2010-09-25 11:59 UTC (permalink / raw)
  To: dash

        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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-25 21:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-25 11:59 exit-ing in a trap handler uses the wrong exit code Loïc Minier
2010-09-25 20:34 ` Jilles Tjoelker
2010-09-25 21:42   ` Loïc Minier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox