From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnH7k-0003QT-F5 for qemu-devel@nongnu.org; Tue, 17 Jan 2012 17:03:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RnH7i-00040J-Vj for qemu-devel@nongnu.org; Tue, 17 Jan 2012 17:03:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnH7i-00040F-P4 for qemu-devel@nongnu.org; Tue, 17 Jan 2012 17:03:22 -0500 Message-ID: <4F15F028.3050302@redhat.com> Date: Tue, 17 Jan 2012 15:03:20 -0700 From: Eric Blake MIME-Version: 1.0 References: <1326492321-13540-1-git-send-email-ryanh@us.ibm.com> <1326492321-13540-3-git-send-email-ryanh@us.ibm.com> <4F10BB74.4050308@redhat.com> <20120116171640.GB25198@us.ibm.com> In-Reply-To: <20120116171640.GB25198@us.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig438A45A238916371EFE646E8" Subject: Re: [Qemu-devel] [PATCH 2/4] Add cleanup function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ryan Harper Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig438A45A238916371EFE646E8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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? >=20 > I thought about that, but it seemed to require switching to /bin/bash Not really. >=20 > 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 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 --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig438A45A238916371EFE646E8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJPFfAoAAoJEKeha0olJ0NqY+cH/2vzv2YVMYyvBe/9uFU9sIFQ oa6oIg76AtsijpcPEHHPvnLcAvzY1MHSjaQx0UeUyN7l0KQwp2nIa3Ogb1ExhOHI Y/WW4nRT89F7WC2+R9LrghFoLjRAiSIdxx1MHWktn/deUBkzdODFmFMIrBNmTITm X19KQ4+t+bUYPhmguZvTqdZ63a6pgod6J6Knm2c+cqkkYHFgbO9u2o2XgxmNtmUY QH/fcVP4yN4cKv9Z27731JJvTWv1Xza50lAkOIzf45NEC0VYir8RBs9j62RnyiQ7 RxFqj9joApxyZH5iyiMqSlRF34ZfK6RE5nfCbdZt/AzN7dfkJ97l4Uw/4yp9MgQ= =8LTG -----END PGP SIGNATURE----- --------------enig438A45A238916371EFE646E8--