bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eli Schwartz
Subject: Re: set -e ignored in subshell if part of command list
Date: Wed, 13 Nov 2019 11:53:57 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

On 11/13/19 10:59 AM, Shaun Crampton wrote:
> But the commands in the subshell execute inside a different shell
> execution context so they shouldn't have
> their own set -e context (Section 2.12)?
> 
> I don't see where the spec says that the subshell has to inherit the
> and/or list-ness of the
> parent context.  Section 2.12 doesn't mention that as being one of the
> things that a subshell inherits
> (and unless I'm missing a good use-case, it seems like a pretty
> useless thing to inherit in a subshell
> or a function that happens to be called on the LHS of an and/or).
You're trying to defend the behavior you *want* set -e to have, even
though many people rely on set -e having the behavior it does, indeed,
have. Why do you require that yet another behavior change be made, so
that it is even harder to know what set -e will do across various
shells, and across various *versions* of a shell?

set -e already has more than enough exceptions to every single rule it
ever had. It's a collection of inchoate nonsensical lexical rules. Don't
use it, for all the reasons enumerated here:

https://mywiki.wooledge.org/BashFAQ/105

Everyone will be much happier if they just don't use set -e, and,
instead, implement actual real error handling that a) works, b) does
what they expect in their own special snowflake case.

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]