Path: csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail From: Eric Blake Newsgroups: gnu.bash.bug Subject: Re: -e does not take effects in subshell Date: Wed, 12 Aug 2015 23:09:59 -0600 Organization: Red Hat, Inc. Lines: 47 Approved: bug-bash@gnu.org Message-ID: References: <20150811135056.GD4309@eeg.ccf.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LA32DePxlVLtB5OREf6dhTM10iI3KNt7I" X-Trace: usenet.stanford.edu 1439442607 6053 208.118.235.17 (13 Aug 2015 05:10:07 GMT) X-Complaints-To: action@cs.stanford.edu Cc: "bug-bash@gnu.org" To: PRC , Greg Wooledge Envelope-to: bug-bash@gnu.org Openpgp: url=http://people.redhat.com/eblake/eblake.gpg User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11337 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LA32DePxlVLtB5OREf6dhTM10iI3KNt7I Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/12/2015 09:54 PM, PRC wrote: > 1. If the function is complicated and contains lots of commands, it=20 > would be more troublesome appending && to every command rather=20 > than simply using one single "set -e" at the front. > 2. It is not=20 > reasonable that suppression of '-e' is applied as well inside the=20 > function. My intention is if my_build succeeds continue to do other=20 > stuff. Does anyone like the rule that a function never fails only if it= is part of a=20 > compound command? Like it or not, it is the historical behavior standardized by POSIX. It is NOT intuitive, and our advice is "DON'T USE set -e - IT WON'T DO WHAT YOU WANT". We can't change the behavior, because it would break scripts that rely on the POSIX-specified behavior. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --LA32DePxlVLtB5OREf6dhTM10iI3KNt7I Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVzCanAAoJEKeha0olJ0NqGdoH/0JdF+9xxaAl1JvYGxJCQKqI 2D9uUaXcm5XcfnSyTz5iqCS6BTGhF7wjpN0vwERJsN6kNHr/BhOr9UQStwgfZMQr chvn7xgsrHpeQo5FEKJAhM9wKzeKI87aQAmlxrzxwQ6rA0sCVTIWe5++mxXd2NGm ufLONDScJtQF+87XM6uNtzgVFZKNlYRZj8m0NLdRMxoyPlurUflRcD/gZ+YzFEQf LQknszQyV5vWfO2vjs281qSlEg11+dabMzOwgbrn3X5InMBoG5yU1nPIctqSqxOj Xxi+FP0x+b8zwiGGe/fOyyJ2Hj6pp3e111QNHEHVyXd3AqJlPyeetFi3pJzrlhw= =bGy8 -----END PGP SIGNATURE----- --LA32DePxlVLtB5OREf6dhTM10iI3KNt7I--