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


Groups > gnu.bash.bug > #15000 > unrolled thread

[IDEA] more granular shell options to fix errexit

Started byIvan Pozdeev <vano@mail.mipt.ru>
First post2018-12-29 07:23 +0300
Last post2018-12-29 07:23 +0300
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

  [IDEA] more granular shell options to fix errexit Ivan Pozdeev <vano@mail.mipt.ru> - 2018-12-29 07:23 +0300

#15000 — [IDEA] more granular shell options to fix errexit

FromIvan Pozdeev <vano@mail.mipt.ru>
Date2018-12-29 07:23 +0300
Subject[IDEA] more granular shell options to fix errexit
Message-ID<mailman.6497.1546063477.1284.bug-bash@gnu.org>
With the recent inherit_errexit , the Bash team seems to have finally 
bumped into a workable way to fix errexit which has been broken for 
decades (https://mywiki.wooledge.org/BashFAQ/105).

Instead of trying to invent a replacement shell option for that and hope 
to get it right on the first try (that errexit failed to), make granular 
options that would each change a single thing -- and see which of them 
pass the test of time.

The following suggested options aim to eliminate all cases that still 
exist, outlined on the above link, where an exit code of a command is 
swallowed/ignored.

* Do not unset `-e' inside a "checked command": only use the logic in 
the "The shell does not exit" clause when checking the exit code of the 
checked command, as a unit.

    (I would argue that this is the intended POSIX semantic in the first 
place but I guess I'm about 25 years late to the party.)
    Suggested option name: preserve_errexit

* If a command substitution fails, fail the containing command. 
Suggested name: cmdsubstfail

* Same for process substitution. Fail the command the same way as a 
pipeline with pipefail (and either only if pipefail is set, or imply 
pipefail). Suggested name: prsubstfail

(Probably the same for history expansion. I don't use it so have no 
opinion here.)

I don't have an opinion if they should be shell options or `shopt' 
options -- no differences to speak of in my book.

-- 
Regards,
Ivan

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web