Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11580

Re: command substitution is stripping set -e from options

Path csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail
From Christoph Gysin <christoph.gysin@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: command substitution is stripping set -e from options
Date Tue, 6 Oct 2015 00:37:34 +0300
Lines 29
Approved bug-bash@gnu.org
Message-ID <mailman.476.1444081099.16064.bug-bash@gnu.org> (permalink)
References <CADex794C1jOf0wrB298_O4ohAqZghYUdd9DJcuaOvV1dCP5AOQ@mail.gmail.com> <560D83DA.9020405@redhat.com> <CADex795r=oqZ7iv4TxrjUn9coDUnu=PgPngkfRWA1f7EZyohfA@mail.gmail.com> <20151002122925.GK25574@eeg.ccf.org> <CADex797-gWHRzpy=gsdORZtU=Os5Qe6f=LwJ7xJ-N-6oHZdd3w@mail.gmail.com> <20151002132221.GL25574@eeg.ccf.org> <56103208.30406@case.edu>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace usenet.stanford.edu 1444081099 19388 208.118.235.17 (5 Oct 2015 21:38:19 GMT)
X-Complaints-To action@cs.stanford.edu
Cc Greg Wooledge <wooledg@eeg.ccf.org>, bug-bash@gnu.org
To Chester Ramey <chet.ramey@case.edu>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=B2vunNaOYO/QsqhVXetmFgeWICZ0hGKw5/xvjZVy74E=; b=yuHyktdw8xh3GUCn6HNj1pChh/id2HF/YymLACfpCjOtEPNl5kafRtNIHF13BxNykL Io/QSEtmyEc1EQkXyywNbbU1xRINmT1S9C4J9SAa6uLXoKADb59QruAqkf8xyki33YYX KonP7AESWgs1n41h7y3qToZsC7xoK+bx5uPqTZB62NgxMy15+IXu6/qhWFd4a98fDvCf mw+cLb0NqjqULd8ECb0ol//5pxqDN9vzyKQbOLACg9c3KjiBp8L+yNvN3xqgDFMv/Lou XB9WZ7lUd/bltzWE0bTl5y6npmZofAS8+53Kh/oOMwiWlT5bc2V5USK4RLfZwOo5nhfJ F0uw==
X-Received by 10.25.26.71 with SMTP id a68mr8397094lfa.109.1444081094426; Mon, 05 Oct 2015 14:38:14 -0700 (PDT)
In-Reply-To <56103208.30406@case.edu>
X-detected-operating-system by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value).
X-Received-From 2a00:1450:4010:c03::230
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11580

Show key headers only | View raw


> The parent shell (the one that enabled -e) should be the one to make the
> decision about whether or not the shell exits.  The exit status of the
> command substitution doesn't make a difference except in one special case,
> so inheriting errexit and exiting (possibly prematurely) doesn't really
> help the parent decide whether or not to exit.

I'm not sure I fully understand.

The parent shell should be the one to decide if the script is supposed
to abort on any unsuccessful exit status. Command substitution should
not change that. The parent shell decided via set -e that it wants to
exit immediately on error.

> Now, of course, it's been more than 20 years, and backwards compatiblity
> is a concern.

I still think this is a bug, I can't imagine why anyone would set "set
-e" and not want to exit on failing commands inside command
substitution. I think posix mode does the right thing in this regard.

If you don't want to fix this for backwards compatibility, is there
anyway we could change that behaviour explicitly? I.e. with another
option? Avoiding command substitution isn't really an option, and this
essentially disables the whole point of set -e.

Chris
-- 
echo mailto: NOSPAM !#$.'<*>'|sed 's. ..'|tr "<*> !#:2" org@fr33z3

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: command substitution is stripping set -e from options Christoph Gysin <christoph.gysin@gmail.com> - 2015-10-06 00:37 +0300

csiph-web