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


Groups > gnu.bash.bug > #16368

Re: bash errexit shell option does not work in some cases.

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: bash errexit shell option does not work in some cases.
Date Mon, 8 Jun 2020 10:02:40 -0400
Organization ITS, Case Western Reserve University
Lines 55
Approved bug-bash@gnu.org
Message-ID <mailman.1437.1591625072.2541.bug-bash@gnu.org> (permalink)
References <5a7df0ba-3ad1-1f35-1107-09fdd5950359@archlinux.org> <3f403934d6b5d23ca58afc5146416c7@cweb006.nm.nfra.io> <1704.1591007300@jinx.noi.kre.to> <20200608112433.GW4133@eeg.ccf.org> <b080b864-da90-06ea-b257-42928e2d544b@case.edu>
Reply-To chet.ramey@case.edu
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1591625072 30123 209.51.188.17 (8 Jun 2020 14:04:32 GMT)
X-Complaints-To action@cs.stanford.edu
Cc chet.ramey@case.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1591625067; bh=nn2VmX9WV1bfiV8LM2goEueyiJPxg4dbW22RYPZUrtk=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=Fnxu417Vr18DHmiSPRCSc51WRmUUaCjUjq3j+GZoU/sD0EWx42PhXWnhTttOIPcI+R i7eMh33oSjuc+sc5WMx4x/FYzKP7fNtCBSywHj/15CJ65xvhLCXMuMI5dPx4AiuDZ3v 2Czt0lYeG86XWhK1pbyCL9bln/N8MTctsG5rBn6jM8AGdMWIxsiEgGvPDzJDRV4BYtL atoY+ix1g9WgtFnEYr3EVBMVZNVGqj9hsbgvgOHQa1l0pbhKrOHexH1Vn8HFA1ELYuD UBHJxKpTtFdR5XsAnt/TaqgBeYowKcrzM6HGXGXCzoj7JnSBY7FPllR7ibjLqtdzqiS Qdt0ZlLQ==
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1591624987; bh=KKvEWxuLPgVysVwa50qEwyCPRHS5UFbXAQLzpLydh58=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=gDRYObYqsZ0uNtJ5+xkACOaCt/rom5v+K1epniYrr7jl6tXYLc5uCjVNsSp/bpK6JA EGqu0n46NSjAdSb08oDvzZ5esFrAYB9lBhjU8T+v6BidV2+q7fyp/IAfxaNDyA/7F7q AUsCmJV/6cCKydybJh7bn8Jrqp7LiUbdqGMVIvCKKKl1oWMS3v1IPpM1fLErj3Nl0nV BdqRoFWNRuOIdUjzIV5IZQDmwr6vQPfj8PlR/ODWZKWeISuoWmmH9wtqyl9cUVU28CM WQQYBnkbhqCD5qLtZNS1gfPRsU2yZ6JE1EvXtx3pQNy3E/qTMQDowjX/rTeRVn6IBtO mVGwOPXA==
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=g-case; h=reply-to:cc:subject:to:references:from:autocrypt:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=KKvEWxuLPgVysVwa50qEwyCPRHS5UFbXAQLzpLydh58=; b=hw3VSaZZpo2suu/NiVag53e3qfDLm24VgiB3Uy7gSPUzII7eu36R67UCrBNS+UFs6G +wvawTi/QzPtx4zHiQ2EtxXJ006TB6CIw3c2EfkSw5aGW8PBvhrvo05HMGLhWukT4dyc EhYQNlTRWV/I2YwIE1qWdMYKrqmVICUWM2GBNCUy/DoaN/iF1Oi/+i5ALJOQ2xke7utS 0kVd4fWEpgOFLN3DWqJTlU+bYqzMVc6VfD3ynKSoBtncxTRJ+/8lFvY2awvex0xvWTyN LV6uzZkFLEmgkdvhBcyd1IYkOMz5HHkTcaboq2QMAjIK+84k8MkmVo3FdW6xO8AjF0B0 6tQg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:cc:subject:to:references:from:autocrypt :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=KKvEWxuLPgVysVwa50qEwyCPRHS5UFbXAQLzpLydh58=; b=g8WBP5yswWgaxNerfeN30VbBbAVBhEoZCUdIsQ2w+WRt5tzsBrcmNKMll9lbCElCWX 45ToWxA4AqblBpp7J3peZGeMPzQYbvaWHrMAYEp54YdCHEAPs2WTPq5ova9yxvtTh5tj FVIu5qDJfoIG0v/RbU05TJWnhtZc7ifAIh94tikMCer5pJvMF4BQEokVNuB9yoQZRW/6 7GFdUkiSM5oThN1RawCRXfRZ9UBrZZrRXVMLCvKMsR7MUcM9UIvO0/BLzflExc9qEZxC KIVPbjH2sHl3amcxcuKkkZjho4uAjQfZGTHlFXy3nmSb67k34+DzORuggk+xqOHuuXil SACA==
X-Gm-Message-State AOAM530q64BNz0K4yH7UBjSCz+a6CGYa6Cgom3NjXpi+c2DrMVyGo4Wb ykLLnDUQGw6Iy8byI4pKB56s1LHCu/tIaLQuJpUMtJ8lykB64oYOUsnTjys9BwCV105+71vI30N 6dOeq+s2zHhI=
X-Received by 2002:a05:6214:b23:: with SMTP id w3mr22613174qvj.63.1591624986106; Mon, 08 Jun 2020 07:03:06 -0700 (PDT)
X-Google-Smtp-Source ABdhPJxa1RPDCyYRblz7/1UBQr+kNepAKk9YyQ5rToNuR98SRCktNZTB1lXk6U3I9vYeAbmmlho2sQ==
X-Received by 2002:a05:6214:b23:: with SMTP id w3mr22613114qvj.63.1591624985495; Mon, 08 Jun 2020 07:03:05 -0700 (PDT)
Autocrypt addr=chet.ramey@case.edu; prefer-encrypt=mutual; keydata= mQG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L+EXo9zSiHVrrZRJ19ooCKKbSdXHFCY+aJG+0KZiEkEGBECAAkFAkEOsG8CGwwACgkQu1hp 8GTqdKvjcACfZlkVCDwaz/NTO9cy3t69oWpVPNwAnRwe0qk/WL/gfhH346xh5B3HFbFN
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.9.0
In-Reply-To <20200608112433.GW4133@eeg.ccf.org>
Content-Language en-US
X-Mirapoint-IP-Reputation reputation=Good-1, source=Queried, refid=tid=0001.0A020301.5EDE3979.000D, actions=tag
X-Mirapoint-IP-Reputation reputation=good-1, source=Fixed, refid=n/a, actions=tag
X-Junkmail-Status score=7/80, host=mpv3-2015.case.edu
X-Junkmail-PrAS-Raw score=7/80, refid=2.7.2:2020.6.8.134518:17:7.944, ip=, rules=__YOUTUBE_RCVD, DKIM_SIGNATURE, __X_GOOGLE_DKIM_SIGNATURE, __HAS_REPLYTO, __HAS_CC_HDR, __SUBJ_REPLY, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __TO_MALFORMED_2, __TO_NO_NAME, __HAS_REFERENCES, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN, __DKIM_ALIGNS_1, __DKIM_ALIGNS_2, __ANY_URI, __URI_MAILTO, __URI_WITH_PATH, __URI_ENDS_IN_SLASH, __URI_NO_WWW, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __MULTIPLE_URI_TEXT, __URI_IN_BODY, __URI_NOT_IMG, __MAIL_CHAIN, __FORWARDED_MSG, __BODY_NO_MAILTO, __NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999, __MIME_TEXT_P1, __MIME_TEXT_ONLY, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
Received-SPF pass client-ip=129.22.103.194; envelope-from=chet.ramey@case.edu; helo=mpv3-2015.case.edu
X-detected-operating-system by eggs.gnu.org: First seen = 2020/06/08 10:04:24
X-ACL-Warn Detected OS = Linux 2.4.x-2.6.x [generic]
X-Spam_score_int -43
X-Spam_score -4.4
X-Spam_bar ----
X-Spam_report (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action no action
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
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 <https://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>
X-Mailman-Original-Message-ID <b080b864-da90-06ea-b257-42928e2d544b@case.edu>
X-Mailman-Original-References <5a7df0ba-3ad1-1f35-1107-09fdd5950359@archlinux.org> <3f403934d6b5d23ca58afc5146416c7@cweb006.nm.nfra.io> <1704.1591007300@jinx.noi.kre.to> <20200608112433.GW4133@eeg.ccf.org>
Xref csiph.com gnu.bash.bug:16368

Show key headers only | View raw


On 6/8/20 7:24 AM, Greg Wooledge wrote:
> On Mon, Jun 01, 2020 at 05:28:20PM +0700, Robert Elz wrote:
>> in this case:
>>
>>   | You're merely the latest person to discover that this applies to you:
>>   | http://mywiki.wooledge.org/BashFAQ/105
>>
>> doesn't really apply - the cases reported are simply bugs in bash,
>> a shell implementing -e correctly should exit as it was expected to.
> 
> The specification of set -e is not fixed.  It keeps changing.  Bash
> implements a version of set -e that was specified at some point in
> the past, which included the phrase "simple command".  So, the rules
> that apply to compound commands and the rules that apply to simple
> commands are not the same.

This explanation is out of date. It's true that back as recently as
2008, POSIX specified that `set -e' worked only if a simple command
failed. Bash implemented that spec, which was incompatible with other
(and historical) shell implementations.
> 
> A more recent POSIX specification has changed the wording, and therefore
> bash's implementation is out of date.  A future version of bash will
> conform to the new wording, which means it will (once again) break
> backward compatibility with older versions of bash (and also with any
> other shells that still implement the older specification).

We hashed out the problems with `set -e' starting back in 2009, and the
standard changed to match historical behavior. This meant that things like
pipelines, (command) subshells, and so on failing would cause the shell to
exit when errexit was enabled. I changed bash to match it starting with
version 4.0, which was followed by much gnashing of teeth and rending of
garments. I'm sure you recall.

No one is arguing that the standard did not change here. In this case,
there was a defect report, (extensive) discussion, an interpretation, and
the standard finally channged in 2013.

> Simply waving this off as a "bug in bash" is quite unfair.

These two cases are, in fact, bugs in bash. They are remnants from the
period when `set -e' only affected simple commands, true, but they are
bugs now nonetheless.

> This is part of the set -e nightmare, which is what we keep trying to
> get you (and everyone else) to understand.

Most of the issue with `set -e' is folks not understanding when it's
not in effect.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

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


Thread

Re: bash errexit shell option does not work in some cases. Chet Ramey <chet.ramey@case.edu> - 2020-06-08 10:02 -0400

csiph-web