From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] don't exit shell on [[ -o invalid@option ]]
Date: Fri, 24 Nov 2017 21:50:22 +0000 [thread overview]
Message-ID: <20171124215022.wegl6xcc22jqdubl@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <1511140961.722411.1177910864.7ECFDEB6@webmail.messagingengine.com>
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
next prev parent reply other threads:[~2017-11-24 21:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-10 18:24 Martijn Dekker
2017-11-10 18:53 ` Eric Cook
2017-11-10 19:03 ` Martijn Dekker
2017-11-10 22:37 ` Bart Schaefer
2017-11-11 12:45 ` Peter Stephenson
2017-11-11 19:01 ` Martijn Dekker
2017-11-11 23:19 ` Bart Schaefer
2017-11-12 19:56 ` Peter Stephenson
2017-11-14 12:26 ` Daniel Shahaf
2017-11-14 13:22 ` Martijn Dekker
2017-11-14 23:52 ` Daniel Shahaf
2017-11-16 0:52 ` Martijn Dekker
2017-11-18 18:22 ` Daniel Shahaf
2017-11-19 14:46 ` Martijn Dekker
2017-11-19 19:41 ` Bart Schaefer
2017-11-19 19:53 ` Peter Stephenson
2017-11-20 1:22 ` Daniel Shahaf
2017-11-24 21:50 ` Daniel Shahaf [this message]
2017-12-03 7:28 ` Mikael Magnusson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171124215022.wegl6xcc22jqdubl@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).