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


Groups > gnu.bash.bug > #15000

[IDEA] more granular shell options to fix errexit

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Ivan Pozdeev <vano@mail.mipt.ru>
Newsgroups gnu.bash.bug
Subject [IDEA] more granular shell options to fix errexit
Date Sat, 29 Dec 2018 07:23:57 +0300
Lines 40
Approved bug-bash@gnu.org
Message-ID <mailman.6497.1546063477.1284.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1546063478 6159 208.118.235.17 (29 Dec 2018 06:04:38 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
X-Virus-Scanned Debian amavisd-new at relay1.telecom.mipt.ru
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=mipt.ru; s=mail; t=1546057448; i=@mipt.ru; bh=Dze98v40QAdYZ9KFcQdnxTFs492emo9c8Mm+qfe6bqM=; h=To:From:Subject:Date:From; b=VNIa3tjVwY8oG6mEAmMfPiprQopve9VfQFzFGIyXtWPg7TnVPhev1D5YZUTKhnpoY xeqdoNks0jDS8c95my9e4IooVJlYLVLK7KPaqJ7KPvOKGNn91tLfm9OphzyxgGNQkx v9quPSl76oeysQyPh7zgS7x+e+2Ay7MgDsJ8TA/A=
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3
Content-Language en-US
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 81.5.91.10
X-Mailman-Approved-At Sat, 29 Dec 2018 01:04:36 -0500
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
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 <http://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>
Xref csiph.com gnu.bash.bug:15000

Show key headers only | View raw


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

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web