From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 776 invoked by alias); 24 Nov 2017 21:59:26 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42048 Received: (qmail 6026 invoked by uid 1010); 24 Nov 2017 21:59:25 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.28):SA:0(-1.9/5.0):. Processed in 11.48485 secs); 24 Nov 2017 21:59:25 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=RPDKHk+dSGyunjcqnIBuZnd6II9JQ SiD8eWGet+Lsf8=; b=eFNGQ8NIcATl5jDYTx2vAtSKDpOcd8GWQ+x7qivYscH9b 9U4d7M56ggRI91k2ZkA+cZLFiq5PpjoQCHtS1shqe1Tnw3BLLohHE97I0LVf+5wR CUDWHFeIo6J77LRtVbUmVCf6+noL+HAbqHb8vrWu+i+PX7MJ7mmhDGL8m5sYaTpe A+lwR+Pli4TLLJWgWmzazdaP+4o0piSs/1I0me0YWRytWgIKg0jHEU8bQgByudve 94lNHTGCcF4EiC00fwqlIqQJUtbmnwXA6F/RhRwiP3i7QZKRbS183Kxq8T9cJeir 5T0iTFmr8eEgpp7s6l0HvSDrFb+91ADyAkU5Gdy1g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=RPDKHk+dSGyunjcqnIBuZnd6II9JQ SiD8eWGet+Lsf8=; b=UlLdm/WWb7PPYWSCm1OiUF2zZskeARKNh2qc9hkauApoB dK1wb03dnANDrzcowD+zkjcBKUSpezJCsCoFLMGPgljv+a/a240F0jPN7gIy4kR3 RGmTWRrX9GbmDjQ1BRxo8DwZO42Axmf+uLEOOrRrokjFKOypdIOtAV/HRp8kBMm1 kPEL6hN/6p7qZVmGT4DQkYike499is9WNT7pBIrEeKdCyex2Txa9jmYSbMVwn5Wh WVkjwy1RZ/W0uFpaxIeaiKhL8s+SQCx96Uxp/CrPZ3zvbN9hcKsBojZEFC/bexEG sTz4UXZ2LD2hlOKBmMv4bTVwPoKD5binYt3a2oa3A== X-ME-Sender: Date: Fri, 24 Nov 2017 21:50:22 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: [PATCH] don't exit shell on [[ -o invalid@option ]] Message-ID: <20171124215022.wegl6xcc22jqdubl@tarpaulin.shahaf.local2> References: <171111151905.ZM20139@torch.brasslantern.com> <20171112195657.74fb0b8a@ntlworld.com> <20171114122619.kqa4i2sth66mafrs@tarpaulin.shahaf.local2> <20171114235249.egcynklamldfcogv@tarpaulin.shahaf.local2> <1511029379.709069.1176966800.1BF7416A@webmail.messagingengine.com> <20171119195337.0a09b303@ntlworld.com> <1511140961.722411.1177910864.7ECFDEB6@webmail.messagingengine.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1511140961.722411.1177910864.7ECFDEB6@webmail.messagingengine.com> User-Agent: NeoMutt/20170113 (1.7.2) Daniel Shahaf wrote on Mon, Nov 20, 2017 at 01:22:41 +0000: > I'm quite swamped this week (in a good way) but when I get a chance I'll > finish the patch and push. (Needs more tests and a README blurb, at least) Interdiff: diff --git a/README b/README index 6fad1d516..59abf29b2 100644 --- a/README +++ b/README @@ -54,6 +54,18 @@ foo=([aeiou]\=vowel) This is only required for array values contained within parentheses; command line expansion for normal arguments has not changed. +3) The syntax + +[[ -o foo ]] + +where foo is not the name of a shell option (with optional underscores +and optional "no" prefix) used to be treated as a syntax error, i.e., +the enclosing command line or file were aborted. It now emits a warning +and returns a non-zero exit code. For further details, see the +documentation of the -o switch in the chapter "Conditional Expressions" +in the zshmisc(1) manual. + + Incompatibilities between 5.3.1 and 5.4.2 ----------------------------------------- diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst index 04e1ca8f2..4ffb07dd4 100644 --- a/Test/C02cond.ztst +++ b/Test/C02cond.ztst @@ -440,14 +440,15 @@ F:Failures in these cases do not indicate a problem in the shell. > [[ 'a' == 'b' || 'b' = 'c' || 'c' != 'd' ]] >} - (setopt posixbuiltins; eval '[[ -o invalidoption ]]; echo set: $?'; echo "no warning" >&2) + (setopt posixbuiltins; [[ -o invalidoption ]]; echo set: $?; echo "line 1: no warning" >&2) (unsetopt posixbuiltins; [[ -o invalidoption ]]; echo unset: $?) [[ -o invalidoption || -n nonempty ]]; echo "in disjunction, true: $?" [[ -o invalidoption || -z nonempty ]]; echo "in disjunction, false: $?" [[ ! -o invalidoption ]]; echo "negated: $?" + [[ -o invalidoption && -n nonempty ]] || echo "in conjunction: $?" 0:-o invalidoption >set: 1 -?no warning +?line 1: no warning >unset: 3 ?(eval):2: no such option: invalidoption >in disjunction, true: 0 @@ -456,6 +457,8 @@ F:Failures in these cases do not indicate a problem in the shell. ?(eval):4: no such option: invalidoption >negated: 3 ?(eval):5: no such option: invalidoption +>in conjunction: 3 +?(eval):6: no such option: invalidoption %clean # This works around a bug in rm -f in some versions of Cygwin