DASH Shell discussions
 help / color / mirror / Atom feed
From: "Loïc Minier" <lool@dooz.org>
To: dash@vger.kernel.org
Subject: exit-ing in a trap handler uses the wrong exit code
Date: Sat, 25 Sep 2010 13:59:00 +0200	[thread overview]
Message-ID: <20100925115900.GA9732@bee.dooz.org> (raw)

        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

             reply	other threads:[~2010-09-25 12:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-25 11:59 Loïc Minier [this message]
2010-09-25 20:34 ` exit-ing in a trap handler uses the wrong exit code Jilles Tjoelker
2010-09-25 21:42   ` Loïc Minier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100925115900.GA9732@bee.dooz.org \
    --to=lool@dooz.org \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox