Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16354
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | worley@alum.mit.edu (Dale R. Worley) |
| Newsgroups | gnu.bash.bug |
| Subject | Re: local failure |
| Date | Tue, 02 Jun 2020 21:42:24 -0400 |
| Lines | 43 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.1027.1591148551.2541.bug-bash@gnu.org> (permalink) |
| References | <CAH+roKX_x6t3sKkbkgc-xa7XXSMpFCUJr6p4kVzXUB=E_pbw8A@mail.gmail.com> <87pnaggc1r.fsf@hobgoblin.ariadne.com> |
| NNTP-Posting-Host | lists.gnu.org |
| X-Trace | usenet.stanford.edu 1591148552 2421 209.51.188.17 (3 Jun 2020 01:42:32 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash@gnu.org, bash@packages.debian.org |
| To | Laurent Picquet <lpicquet@gmail.com>, John Passaro <john.a.passaro@gmail.com> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcastmailservice.net; s=20180828_2048; t=1591148546; bh=VZhYHJ4p87+JRqpOFdcx57uVbWV4tvQ+HJ6RR8OptcA=; h=Received:Received:Received:Received:From:To:Subject:Date: Message-ID; b=KSk+4ZwwZrzKkG0DQ4lF5iFtYkMzy1gvEXF5zUnK9je6ejogiIJoQxJ1FZ7HmzYOo yK/DI77wog0WbHatyqJdcsC4x6uSdZaRnzdGl6LY28ldWB0bEpT1PEB9H0h118u4bW j8Yrn0rDiZZ01U76/WAZ0YRtnYVpo0xb6VIfIUdigP4lP9tdK4p7XA6MxYZZO7ZGfK tLLFiZhycu7pcOyzLLvT4uVrcGhTqczJwCfFdAnxOEetp/NszaTuzPsHMUd7p5Cx/Z 1rVvuJlCdT7vK7PVy4QfVhuJX53ayGOSBx8oBjN4a5lAiMZQbt8tg7020vocK50P9A 9MjGBvwwnRpug== |
| X-Xfinity-VMeta | sc=-100.00;st=legit |
| X-Authentication-Warning | hobgoblin.ariadne.com: worley set sender to worley@alum.mit.edu using -f |
| In-Reply-To | <CAH+roKX_x6t3sKkbkgc-xa7XXSMpFCUJr6p4kVzXUB=E_pbw8A@mail.gmail.com> (lpicquet@gmail.com) |
| Received-SPF | permerror client-ip=2001:558:fe21:29:69:252:207:33; envelope-from=worley@alum.mit.edu; helo=resqmta-ch2-01v.sys.comcast.net |
| X-detected-operating-system | by eggs.gnu.org: First seen = 2020/06/02 21:42:26 |
| X-ACL-Warn | Detected OS = ??? |
| X-Spam_score_int | -25 |
| X-Spam_score | -2.6 |
| X-Spam_bar | -- |
| X-Spam_report | (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, T_SPF_PERMERROR=0.01, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN |
| X-Spam_action | no action |
| 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 | <87pnaggc1r.fsf@hobgoblin.ariadne.com> |
| Xref | csiph.com gnu.bash.bug:16354 |
Show key headers only | View raw
Laurent Picquet <lpicquet@gmail.com> writes:
> Should the 'local' command be the one able to detect that the assignment to
> the variable had an non-zero exit code and return the non-zero exit code?
John Passaro <john.a.passaro@gmail.com> writes:
> I think the underlying question here is not exactly "how do I gather this
> from the docs" as much as it is "how was I supposed to know about this and
> act on it before I had to debug it?"
>From where I stand, the situation appears differently. I knew that the
the exit code from the command inside $( ... ) is ignored. So when
someone complained that
FOO=$( false)
exits 1 but
echo $( false )
exits 0, my reflex was that the first one was a bug.
It was only when I went to the man page and read up did I discover to my
surprise that the exit status of $( ... ) in standalone assignments is
the exit status of the assignment.
So my first answer is "You're supposed to know that the exit status of
$( ... ) is discarded as it is a fundamental property of command
substitution." Other than for the fact that it's only sometimes true...
I would argue that "local" should not have any special behavior in
regard to command substitution, as that would be Yet Another Special
Case.
Though it seems to me that one can get finer control over command
substitution by doing:
FOO="$( command1 )"
# Test $? here to find out what command1 did.
command2 $FOO
# Test $? here to find out what command2 did.
No doubt the special case for how command substitution exit statuses in
standalone assignments are handled was done specifically to make this
possible.
Dale
Back to gnu.bash.bug | Previous | Next | Find similar
Re: local failure worley@alum.mit.edu (Dale R. Worley) - 2020-06-02 21:42 -0400
csiph-web