Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15668
| Path | csiph.com!tncsrv06.tnetconsulting.net!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Shaun Crampton <shaun@tigera.io> |
| Newsgroups | gnu.bash.bug |
| Subject | set -e ignored in subshell if part of command list |
| Date | Wed, 13 Nov 2019 10:24:23 +0000 |
| Lines | 43 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.1340.1573656062.13325.bug-bash@gnu.org> (permalink) |
| References | <CAMhR0U1fzAvXMVZacEYf9yAPwgq_6Gz5C-99dj6xt=9pQMtX8Q@mail.gmail.com> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| X-Trace | usenet.stanford.edu 1573656063 31056 209.51.188.17 (13 Nov 2019 14:41:03 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=tigera.io; s=google; h=mime-version:from:date:message-id:subject:to; bh=ReSfzEhbAs8XcSY+pAbcULIYOT8O/VTqrI5OyrvJ5Gg=; b=J1U5WoNNxOgQ6UhUcSlOfAcg63CDKvf8xnqwfVYyv9HzO44rhATK6PLPer4cjMGJGh AIGGWAKwMuJl5faNfJC2njtNn/yeW1Xsqmm88uiun+NmTCiVHIDu1covd5dGb7pmfxx7 t8AAP+OpUpAEiwNE1+/Rkgqvi+4ISMbFm0i7Q= |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ReSfzEhbAs8XcSY+pAbcULIYOT8O/VTqrI5OyrvJ5Gg=; b=jjnPdTkmnbXNi2AZvIO3Q15qO6htZCL5NfCc14D+gXGM/WcYcBKaf3/7xEhQDfhN/A 5mwaiLeWw99v4/T/Eh0Vaf8UhW55EsAKQ5YcSjWB32X3Via/Mj1cM3eoXGFCbxs/ijmK fIilC7bWm1AaX8lQXqvUe1BS6paY4JtNvGkPlMHYQ4zI0racaxpJRG1WqX86r18k3Bg3 XHyvUg4Y0jKObNNenhSbQGwNjjRkQwRM31WwJNKhS7YvwK8OCSwB62+HxEeVVRA/0OcD cGDpIZsZ0p7HEQPKzCnHxbjKPBMIlzbNNpcqGpKZ1CWdeB3RA5D91Q89BCNoNswuBMid bKGw== |
| X-Gm-Message-State | APjAAAX2hes0pz65gC6M8PJ5AQl9LGix8I7NTjsT6OGTHE9tivAK25C7 h8eaWbLv/vjSsOCbiYYnPTjg1xsM1FtVnVoN6ySlcZ9VoBYdwQ== |
| X-Google-Smtp-Source | APXvYqw1juOFJu+FlldGlM4KEIXRyKetv68Zx6zE+rcgHTE4eahcGr+tLF3NWJximMts5AEsm2m5fRIt+VDcF2qha+k= |
| X-Received | by 2002:a05:6102:318e:: with SMTP id c14mr1400401vsh.45.1573640673761; Wed, 13 Nov 2019 02:24:33 -0800 (PST) |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2607:f8b0:4864:20::e2a |
| X-Mailman-Approved-At | Wed, 13 Nov 2019 09:41:02 -0500 |
| 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 | <CAMhR0U1fzAvXMVZacEYf9yAPwgq_6Gz5C-99dj6xt=9pQMtX8Q@mail.gmail.com> |
| Xref | csiph.com gnu.bash.bug:15668 |
Show key headers only | View raw
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
-fdebug-prefix-map=/build/bash-LQgi2O/bash-5.0=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux shauns-laptop 5.1.16-050116-generic #201907031232
SMP Wed Jul 3 12:35:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 3
Release Status: release
Description:
I was trying to get a function to return early if a command
fails by putting
the body of the function in a subshell and using set -e inside
the subshell.
If I run a subshell on its own, this works, but when I try to combine it
into a larger program, the set -e gets ignored.
Repeat-By:
Managed to boil it down to this smaller example:
# On its own, subshell behaves as expected:
$ ( set -ex; false; echo here )
+ false
# In a list, behaviour changes, "echo here" gets executed:
$ ( set -ex; false; echo here ) && echo there
+ false
+ echo here
here
there
# If the subshell is executed in the background, it works
$ ( set -e; false; echo here ) & pid=$!; wait $pid && echo there
[1] 26219
[1]+ Exit 1 ( set -e; false; echo here )
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
set -e ignored in subshell if part of command list Shaun Crampton <shaun@tigera.io> - 2019-11-13 10:24 +0000
csiph-web