bug-bash
[Top][All Lists]
Advanced

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

Re: Consolidate recommended options?


From: Lawrence Velázquez
Subject: Re: Consolidate recommended options?
Date: Sun, 29 Dec 2024 16:34:20 -0500

On Sun, Dec 29, 2024, at 3:54 PM, Daniel Colascione wrote:
> Are you really indifferent as to whether array indexes should be 
> evaluated once or twice? Have you seen 
> https://yossarian.net/til/post/some-surprising-code-execution-sources-in-bash/?

I'm aware of the pitfalls described therein, and more.  I don't
think anyone thinks multiple evaluation in indexes is good per se,
but many find the side effects of the attempted cures worse than
the disease (e.g., https://mywiki.wooledge.org/BashPitfalls#pf62).

> Bash has some unfortunate unfixable defaults avoidable if you know how. 
> Don't you think it should be easier to avoid them? I have a hard time 
> seeing how anyone would choose some of these old behaviors on purpose.

Providing a metaoption would falsely imply that the bash project
officially endorses the chosen settings as Best Practice (TM).
You think they are, but plenty of people disagree, mostly due to
collateral damage that "modern bash" advocates don't seem to know
or care about.  For example, regarding "set -euo pipefail" alone:

https://mywiki.wooledge.org/BashPitfalls#pf60
https://mywiki.wooledge.org/BashFAQ/105
https://mywiki.wooledge.org/BashFAQ/112

Believe it or not, this topic is controversial, and I don't think
the shell itself ought to take a position on it.  (Even if it did,
the ensuing discussion about which settings to bless would itself
be interminable.)  It's trivial to collect your preferred settings
in one file and source it from your scripts.

-- 
vq



reply via email to

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