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


Groups > gnu.bash.bug > #15672

Re: set -e ignored in subshell if part of command list

Path csiph.com!tncsrv06.tnetconsulting.net!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From achurch@achurch.org (Andrew Church)
Newsgroups gnu.bash.bug
Subject Re: set -e ignored in subshell if part of command list
Date Thu, 14 Nov 2019 00:59:25 +0900
Lines 31
Approved bug-bash@gnu.org
Message-ID <mailman.1349.1573660804.13325.bug-bash@gnu.org> (permalink)
References <13040a55-507d-e072-e827-be7c33be968f@case.edu> <5dcc2873.17477@msgid.achurch.org>
NNTP-Posting-Host lists.gnu.org
Content-Type text/plain; charset=utf-8
X-Trace usenet.stanford.edu 1573660805 1179 209.51.188.17 (13 Nov 2019 16:00:05 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org
To chet.ramey@case.edu
Envelope-to bug-bash@gnu.org
X-wmail-status normal
In-Reply-To <13040a55-507d-e072-e827-be7c33be968f@case.edu>
X-Mailer MMail v5.51
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 60.39.233.218
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
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 <https://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>
X-Mailman-Original-Message-ID <5dcc2873.17477@msgid.achurch.org>
Xref csiph.com gnu.bash.bug:15672

Show key headers only | View raw


>"The -e setting shall be ignored when executing the compound list following
>the while, until, if, or elif reserved word, a pipeline beginning with the
>! reserved word, or any command of an AND-OR list other than the last."
>
>(from 
>https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25_03)
>
>The subshell inherits this state (being part of an and-or list) from its
>parent.

Is that really the intent of the requirement, though?  The same section
states: "This requirement applies to the shell environment and each
subshell environment separately", which I read to mean that the rules
should be evaluated without consideration of any parent or subshell
environment other than the one in which the -e option is being applied.
And the example:

set -e; (false; echo one) | cat; echo two

shows rule 1 ("The failure of any individual command in a multi-command
pipeline shall not cause the shell to exit") not being applied within
the subshell, even though the subshell as a whole is an "individual
command in a multi-command pipeline".  I don't see any suggestion that
the case of an AND-OR list in rule 2 should be treated differently, and
absent an explicit requirement one way or the other, I think the
expected behavior here would be that the behavior of the subshell is
independent of the subshell's context in the parent shell.

  --Andrew Church
    http://achurch.org/

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


Thread

Re: set -e ignored in subshell if part of command list achurch@achurch.org (Andrew Church) - 2019-11-14 00:59 +0900

csiph-web