Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Ivan Pozdeev 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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:15000 With the recent inherit_errexit , the Bash team seems to have finally=20 bumped into a workable way to fix errexit which has been broken for=20 decades (https://mywiki.wooledge.org/BashFAQ/105). Instead of trying to invent a replacement shell option for that and hope=20 to get it right on the first try (that errexit failed to), make granular=20 options that would each change a single thing -- and see which of them=20 pass the test of time. The following suggested options aim to eliminate all cases that still=20 exist, outlined on the above link, where an exit code of a command is=20 swallowed/ignored. * Do not unset `-e' inside a "checked command": only use the logic in=20 the "The shell does not exit" clause when checking the exit code of the=20 checked command, as a unit. =C2=A0=C2=A0 (I would argue that this is the intended POSIX semantic in = the first=20 place but I guess I'm about 25 years late to the party.) =C2=A0=C2=A0 Suggested option name: preserve_errexit * If a command substitution fails, fail the containing command.=20 Suggested name: cmdsubstfail * Same for process substitution. Fail the command the same way as a=20 pipeline with pipefail (and either only if pipefail is set, or imply=20 pipefail). Suggested name: prsubstfail (Probably the same for history expansion. I don't use it so have no=20 opinion here.) I don't have an opinion if they should be shell options or `shopt'=20 options -- no differences to speak of in my book. --=20 Regards, Ivan