qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ryan Harper <ryanh@us.ibm.com>
To: Eric Blake <eblake@redhat.com>
Cc: Ryan Harper <ryanh@us.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/4] Add cleanup function
Date: Fri, 20 Jan 2012 09:33:02 -0600	[thread overview]
Message-ID: <20120120153302.GD18501@us.ibm.com> (raw)
In-Reply-To: <4F15F028.3050302@redhat.com>

* Eric Blake <eblake@redhat.com> [2012-01-17 16:03]:
> On 01/16/2012 10:16 AM, Ryan Harper wrote:
> >>>  if test -z "$1" -o -z "$2"; then
> >>>      echo "Usage: $0 QEMU TEST1 [TEST2 ...]"
> >>> +    cleanup
> >>>      exit 1
> >>
> >> Is it worth using 'trap cleanup 0' to install the cleanup handler up
> >> front, instead of modifying all exit call sites?
> > 
> > I thought about that, but it seemed to require switching to /bin/bash
> 
> Not really.
> 
> > 
> > and I know Anthony had written the scripts carefully to be /bin/sh.
> 
> POSIX requires /bin/sh to support 'trap cleanup 0', and I don't know of

I was using trap cleanup SIGINT; which /bin/sh didn't like:

(finalgravity) qemu-test % ./qemu-test ~/work/git/qemu/x86_64-softmmu/qemu-system-x86_64 tests/virtio-serial.sh 
trap: SIGINT: bad trap

but with 0 instead, that seems to work.

> any counter-example shells that fail to do this.  There are non-POSIX
> shells where installing a trap 0 handler from inside a function body
> invokes the handler upon exiting the function, instead of exiting the
> overall script, but even Solaris /bin/sh knows how to correctly handle a
> trap 0 handler installed outside of any function calls.
> 
> https://www.gnu.org/software/autoconf/manual/autoconf.html#trap
> 
> -- 
> Eric Blake   eblake@redhat.com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 



-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ryanh@us.ibm.com

  reply	other threads:[~2012-01-20 15:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-13 22:05 [Qemu-devel] [PATCH] qemu-test: qemu-test script cleanups Ryan Harper
2012-01-13 22:05 ` [Qemu-devel] [PATCH 1/4] update get_file_size to not throw error on non-existant files Ryan Harper
2012-01-13 22:05 ` [Qemu-devel] [PATCH 2/4] Add cleanup function Ryan Harper
2012-01-13 23:17   ` Eric Blake
2012-01-16 17:16     ` Ryan Harper
2012-01-17 22:03       ` Eric Blake
2012-01-20 15:33         ` Ryan Harper [this message]
2012-01-13 22:05 ` [Qemu-devel] [PATCH 3/4] Remove tabs and replace with four spaces Ryan Harper
2012-01-13 23:10   ` Anthony Liguori
2012-01-13 22:05 ` [Qemu-devel] [PATCH 4/4] Apply consistent indentation Ryan Harper

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=20120120153302.GD18501@us.ibm.com \
    --to=ryanh@us.ibm.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).