Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: illegal -> invalid, invalid option -> bad option
- X-seq: zsh-workers 54721
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: illegal -> invalid, invalid option -> bad option
- Date: Tue, 9 Jun 2026 02:59:38 +0200
- Archived-at: <https://zsh.org/workers/54721>
- List-id: <zsh-workers.zsh.org>
Combinations of options can remain invalid, though.
---
Discussed on IRC with Oliver and dana, but I'm sure people on the list would like to
bikeshed about this too?
Doc/Zsh/expn.yo | 2 +-
Doc/intro.ms | 2 +-
Functions/Misc/zmv | 2 +-
Src/Modules/zpty.c | 2 +-
Src/Modules/zutil.c | 2 +-
Src/Zle/compctl.c | 18 +++++++++---------
Src/Zle/computil.c | 14 +++++++-------
Src/Zle/zle_main.c | 2 +-
Src/Zle/zle_refresh.c | 2 +-
Src/builtin.c | 6 +++---
Src/glob.c | 2 +-
Src/hist.c | 2 +-
Src/jobs.c | 2 +-
Src/math.c | 4 ++--
Src/module.c | 4 ++--
Src/parse.c | 2 +-
Test/B02typeset.ztst | 2 +-
Test/B10getopts.ztst | 4 ++--
Test/B11kill.ztst | 16 ++++++++--------
Test/D04parameter.ztst | 6 +++---
Test/K01nameref.ztst | 2 +-
Test/V13zformat.ztst | 2 +-
22 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 0cefaf7d1d..b91c909327 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -1699,7 +1699,7 @@ are not the same as the flags used within parameter substitutions.
At the outermost level of substitution, the `tt((P))' flag (rule tt(4.))
ignores these transformations and uses the unmodified value of the
parameter as the name to be replaced. This is usually the desired
-behavior because padding may make the value syntactically illegal as a
+behavior because padding may make the value syntactically invalid as a
parameter name, but if capitalization changes are desired, use the
tt(${${(P)foo}}) form (rule tt(25.)).
)
diff --git a/Doc/intro.ms b/Doc/intro.ms
index 3aabf15199..a6f5d5ea5a 100644
--- a/Doc/intro.ms
+++ b/Doc/intro.ms
@@ -2626,7 +2626,7 @@ foo
%
.De
-With \fICSHJUNKIEQUOTES\fP set, this is illegal, as it is
+With \fICSHJUNKIEQUOTES\fP set, this is invalid, as it is
in csh.
.Ds
%\0setopt\0cshjunkiequotes
diff --git a/Functions/Misc/zmv b/Functions/Misc/zmv
index 2002af5a65..ed48683463 100644
--- a/Functions/Misc/zmv
+++ b/Functions/Misc/zmv
@@ -183,7 +183,7 @@ repl=$2
shift 2
if [[ -n $opt_s && $action != ln ]]; then
- print -r -- "$myname: invalid option: -s" >&2
+ print -r -- "$myname: bad option: -s" >&2
return 1
fi
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index de450be7a5..5f3a8f24e2 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -803,7 +803,7 @@ bin_zpty(char *nam, char **args, Options ops, UNUSED(int func))
OPT_ISSET(ops,'m'))) ||
(OPT_ISSET(ops,'L') && (OPT_ISSET(ops,'b') || OPT_ISSET(ops,'e') ||
OPT_ISSET(ops,'m')))) {
- zwarnnam(nam, "illegal option combination");
+ zwarnnam(nam, "invalid option combination");
return 1;
}
if (OPT_ISSET(ops,'r') || OPT_ISSET(ops,'w')) {
diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c
index 6f53f5c535..8a1af5dbfb 100644
--- a/Src/Modules/zutil.c
+++ b/Src/Modules/zutil.c
@@ -595,7 +595,7 @@ bin_zstyle(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
case 'q': min = 2; max = 2; break;
case 'g': min = 1; max = 3; break;
default:
- zwarnnam(nam, "invalid option: %s", args[0]);
+ zwarnnam(nam, "bad option: %s", args[0]);
return 1;
}
n = arrlen(args) - 1;
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index e1b32cc26f..3c2bc94e4b 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -513,7 +513,7 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
char *p;
if (cl) {
- zwarnnam(name, "illegal option -%c", arg);
+ zwarnnam(name, "bad option: -%c", arg);
return 1;
}
if (**argv) {
@@ -656,7 +656,7 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
break;
case 'l':
if (cl) {
- zwarnnam(name, "illegal option -%c", arg);
+ zwarnnam(name, "bad option: -%c", arg);
return 1;
} else if (**argv) {
cct.subcmd = *argv;
@@ -671,7 +671,7 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
break;
case 'h':
if (cl) {
- zwarnnam(name, "illegal option -%c", arg);
+ zwarnnam(name, "bad option: -%c", arg);
return 1;
} else if (**argv) {
cct.substr = *argv;
@@ -778,7 +778,7 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
break;
case 'C':
if (cl) {
- zwarnnam(name, "illegal option -%c", arg);
+ zwarnnam(name, "bad option: -%c", arg);
return 1;
}
if (first && !hx) {
@@ -790,7 +790,7 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
break;
case 'D':
if (cl) {
- zwarnnam(name, "illegal option -%c", arg);
+ zwarnnam(name, "bad option: -%c", arg);
return 1;
}
if (first && !hx) {
@@ -803,7 +803,7 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
break;
case 'T':
if (cl) {
- zwarnnam(name, "illegal option -%c", arg);
+ zwarnnam(name, "bad option: -%c", arg);
return 1;
}
if (first && !hx) {
@@ -815,11 +815,11 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
break;
case 'L':
if (cl) {
- zwarnnam(name, "illegal option -%c", arg);
+ zwarnnam(name, "bad option: -%c", arg);
return 1;
}
if (!first || hx) {
- zwarnnam(name, "illegal use of -L flag");
+ zwarnnam(name, "invalid use of -L flag");
return 1;
}
cclist |= COMP_LIST;
@@ -859,7 +859,7 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
if (*++argv && (!ready || ready == 2) &&
**argv == '+' && !argv[0][1]) {
if (cl) {
- zwarnnam(name, "xor'ed completion illegal");
+ zwarnnam(name, "xor'ed completion invalid");
return 1;
}
/* There's an alternative (+) completion: assign
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 43018c2e51..8ba1b07e04 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -890,7 +890,7 @@ bin_compdescribe(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
return 1;
}
}
- zwarnnam(nam, "invalid option: %s", args[0]);
+ zwarnnam(nam, "bad option: %s", args[0]);
return 1;
}
@@ -2632,7 +2632,7 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
case 'W': min = 3; max = 3; break;
case 'n': min = 1; max = 1; break;
default:
- zwarnnam(nam, "invalid option: %s", args[0]);
+ zwarnnam(nam, "bad option: %s", args[0]);
return 1;
}
n = arrlen(args) - 1;
@@ -3524,7 +3524,7 @@ bin_compvalues(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
case 'L': min = 3; max = 4; break;
case 'v': min = 1; max = 1; break;
default:
- zwarnnam(nam, "invalid option: %s", args[0]);
+ zwarnnam(nam, "bad option: %s", args[0]);
return 1;
}
n = arrlen(args) - 1;
@@ -3886,7 +3886,7 @@ bin_comptags(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
case 'S': min = 1; max = 1; break;
case 'A': min = 2; max = 3; break;
default:
- zwarnnam(nam, "invalid option: %s", args[0]);
+ zwarnnam(nam, "bad option: %s", args[0]);
return 1;
}
n = arrlen(args) - 1;
@@ -5007,7 +5007,7 @@ bin_compfiles(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
case 'p':
case 'P':
if (args[0][2] && (args[0][2] != '-' || args[0][3])) {
- zwarnnam(nam, "invalid option: %s", *args);
+ zwarnnam(nam, "bad option: %s", *args);
return 1;
} else {
char **tmp;
@@ -5035,7 +5035,7 @@ bin_compfiles(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
}
case 'i':
if (args[0][2]) {
- zwarnnam(nam, "invalid option: %s", *args);
+ zwarnnam(nam, "bad option: %s", *args);
return 1;
} else {
char **tmp;
@@ -5091,7 +5091,7 @@ bin_compfiles(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
return ret;
}
}
- zwarnnam(nam, "invalid option: %s", *args);
+ zwarnnam(nam, "bad option: %s", *args);
return 1;
}
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 37d587d023..ea88a42475 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1154,7 +1154,7 @@ zlecore(void)
break;
}
handleprefixes();
- /* for vi mode, make sure the cursor isn't somewhere illegal */
+ /* for vi mode, make sure the cursor isn't somewhere invalid */
if (invicmdmode() && zlecs > findbol() &&
(zlecs == zlell || zleline[zlecs] == ZWC('\n')))
DECCS();
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 8c2a645df4..b3a648056a 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -2064,7 +2064,7 @@ refreshline(int ln)
/*
* inserting characters - characters pushed off the right
* should be annihilated, but we don't do this if we're on the
- * last line lest undesired scrolling occurs due to `illegal'
+ * last line lest undesired scrolling occurs due to `invalid'
* characters on screen
*/
if (tccan(TCINS) && (vln != zterm_lines - 1)) {
diff --git a/Src/builtin.c b/Src/builtin.c
index 96de181283..e4bd714020 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3397,7 +3397,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
(OPT_MINUS(ops,'X') && (OPT_ISSET(ops,'m') || !scriptname)) ||
(OPT_ISSET(ops,'c') && (OPT_ISSET(ops,'x') || OPT_ISSET(ops,'X') ||
OPT_ISSET(ops,'m')))) {
- zwarnnam(name, "invalid option(s)");
+ zwarnnam(name, "bad option(s)");
return 1;
}
@@ -3474,7 +3474,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
*/
if (on || off || pflags || OPT_ISSET(ops,'X') || OPT_ISSET(ops,'u')
|| OPT_ISSET(ops,'U') || OPT_ISSET(ops,'w')) {
- zwarnnam(name, "invalid option(s)");
+ zwarnnam(name, "bad option(s)");
return 1;
}
if (!*argv) {
@@ -4465,7 +4465,7 @@ bin_alias(char *name, char **argv, Options ops, UNUSED(int func))
OPT_ISSET(ops, 's');
if (type_opts) {
if (type_opts > 1) {
- zwarnnam(name, "illegal combination of options");
+ zwarnnam(name, "invalid combination of options");
return 1;
}
if (OPT_ISSET(ops,'g'))
diff --git a/Src/glob.c b/Src/glob.c
index dab3d0ec7c..b9f7223781 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -2485,7 +2485,7 @@ xpandbraces(LinkList list, LinkNode *np)
cnt++;
else if (*str == Outbrace)
cnt--;
- DPUTS(!*str, "BUG: illegal brace expansion");
+ DPUTS(!*str, "BUG: invalid brace expansion");
}
/* Concatenate the string before the braces (str3), the section *
* just found (str4) and the text after the braces (str2) */
diff --git a/Src/hist.c b/Src/hist.c
index a6d258156c..348531aa07 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -956,7 +956,7 @@ histsubchar(int c)
break;
default:
convchar_t wc = herrflushone(c);
- zerr("illegal modifier: %c", wc);
+ zerr("invalid modifier: %c", wc);
return -1;
}
} else {
diff --git a/Src/jobs.c b/Src/jobs.c
index 9714f4eb9a..1594ee58e1 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -3018,7 +3018,7 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
killjb(jobtab + p, SIGCONT);
}
} else if (!isanum(*argv)) {
- zwarnnam("kill", "illegal pid: %s", *argv);
+ zwarnnam("kill", "invalid pid: %s", *argv);
returnval++;
} else {
int pid = atoi(*argv);
diff --git a/Src/math.c b/Src/math.c
index fab26116f7..517c181180 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -1102,7 +1102,7 @@ callmathfunc(char *o)
}
if (*a && !errflag) {
convchar_t wa = unmeta_one(a, NULL);
- zerr("bad math expression: illegal character: %c", wa);
+ zerr("bad math expression: invalid character: %c", wa);
}
if (!errflag) {
if (argc >= f->minargs && (f->maxargs < 0 ||
@@ -1501,7 +1501,7 @@ matheval(char *s)
mtok = xmtok;
if (*junk) {
convchar_t j = unmeta_one(junk, NULL);
- zerr("bad math expression: illegal character: %c", j);
+ zerr("bad math expression: invalid character: %c", j);
}
return x;
}
diff --git a/Src/module.c b/Src/module.c
index 83a518c442..b01b6c6b31 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -2461,7 +2461,7 @@ bin_zmodload(char *nam, char **args, Options ops, UNUSED(int func))
if (OPT_ISSET(ops,'A') || OPT_ISSET(ops,'R')) {
if (ops_bcpf || ops_au || OPT_ISSET(ops,'d') ||
(OPT_ISSET(ops,'R') && OPT_ISSET(ops,'e'))) {
- zwarnnam(nam, "illegal flags combined with -A or -R");
+ zwarnnam(nam, "invalid flags combined with -A or -R");
return 1;
}
if (!OPT_ISSET(ops,'e'))
@@ -3527,7 +3527,7 @@ autofeatures(const char *cmdnam, const char *module, char **features,
}
if (strchr(fnam, '/')) {
- zwarnnam(cmdnam, "%s: `/' is illegal in a %s", fnam, typnam);
+ zwarnnam(cmdnam, "%s: `/' is invalid in a %s", fnam, typnam);
ret = 1;
continue;
}
diff --git a/Src/parse.c b/Src/parse.c
index 8d6c8ca635..beb9be0590 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -3187,7 +3187,7 @@ bin_zcompile(char *nam, char **args, Options ops, UNUSED(int func))
(OPT_ISSET(ops,'c') &&
(OPT_ISSET(ops,'U') || OPT_ISSET(ops,'k') || OPT_ISSET(ops,'z'))) ||
(!(OPT_ISSET(ops,'c') || OPT_ISSET(ops,'a')) && OPT_ISSET(ops,'m'))) {
- zwarnnam(nam, "illegal combination of options");
+ zwarnnam(nam, "invalid combination of options");
return 1;
}
if ((OPT_ISSET(ops,'c') || OPT_ISSET(ops,'a')) && isset(KSHAUTOLOAD))
diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst
index 8839e38918..32e79ced22 100644
--- a/Test/B02typeset.ztst
+++ b/Test/B02typeset.ztst
@@ -18,7 +18,7 @@
# Function tracing (typeset -ft) E02xtrace
# Not yet tested:
-# Assorted illegal flag combinations
+# Assorted invalid flag combinations
# For a few tests, we include a
# typeset -p param
diff --git a/Test/B10getopts.ztst b/Test/B10getopts.ztst
index 5ababebcc8..4e1893fc4d 100644
--- a/Test/B10getopts.ztst
+++ b/Test/B10getopts.ztst
@@ -73,11 +73,11 @@
>test_getopts:3: argument expected after +c option
test_getopts -x
-1:one illegal option
+1:one invalid option
>test_getopts:3: bad option: -x
test_getopts +x
-1:one illegal option, + variant
+1:one invalid option, + variant
>test_getopts:3: bad option: +x
set -- -x
diff --git a/Test/B11kill.ztst b/Test/B11kill.ztst
index dc6bf9b897..c792033210 100644
--- a/Test/B11kill.ztst
+++ b/Test/B11kill.ztst
@@ -35,17 +35,17 @@
kill a b c
)
3:kill with multiple wrong inputs should increment status
-?(eval):kill:2: illegal pid: a
-?(eval):kill:2: illegal pid: b
-?(eval):kill:2: illegal pid: c
+?(eval):kill:2: invalid pid: a
+?(eval):kill:2: invalid pid: b
+?(eval):kill:2: invalid pid: c
(
kill -INT a b c
)
3:kill with sigspec and wrong inputs should increment status
-?(eval):kill:2: illegal pid: a
-?(eval):kill:2: illegal pid: b
-?(eval):kill:2: illegal pid: c
+?(eval):kill:2: invalid pid: a
+?(eval):kill:2: invalid pid: b
+?(eval):kill:2: invalid pid: c
(
kill
@@ -75,12 +75,12 @@
kill -URG ''
)
1:kill with empty pid and sigspec should not send signal to current process group
-?(eval):kill:3: illegal pid:
+?(eval):kill:3: invalid pid:
(
trap 'exit 19' TERM
kill ''
)
1:Plain kill with empty pid should not send signal to current process group
-?(eval):kill:3: illegal pid:
+?(eval):kill:3: invalid pid:
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index c09821c85e..e5fb2e5b3e 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -2429,13 +2429,13 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
(
IFS=$'\x80'
if [[ $IFS = $' \t\n\0' ]]; then
- echo OK # if $'\x80' is illegal (e.g. Linux)
+ echo OK # if $'\x80' is invalid (e.g. Linux)
else # otherwise (e.g. macOS), it should work as a separator
s=$'foo\x80\bar'
[[ ${${=s}[1]} = foo ]] && echo OK
fi
)
-0D:reset IFS to default if it contains illegal character
+0D:reset IFS to default if it contains invalid character
>OK
(
@@ -2955,7 +2955,7 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
: ${(#X):-@}
1:${(#X)...}: bad math expression
-?(eval):1: bad math expression: illegal character: @
+?(eval):1: bad math expression: invalid character: @
echo a${(#):-@}z
0:${(#)...}: bad math expression
diff --git a/Test/K01nameref.ztst b/Test/K01nameref.ztst
index 0b44758270..b89c3ead67 100644
--- a/Test/K01nameref.ztst
+++ b/Test/K01nameref.ztst
@@ -282,7 +282,7 @@ F:note this causes "var" to become set
*?*var\[2\]: can't change type via subscript reference
typeset -n ptr[1]=var
-1:illegal nameref name
+1:invalid nameref name
*?*reference variable cannot be an array
typeset var=value
diff --git a/Test/V13zformat.ztst b/Test/V13zformat.ztst
index 449b963380..74fc14ae85 100644
--- a/Test/V13zformat.ztst
+++ b/Test/V13zformat.ztst
@@ -181,7 +181,7 @@
for 1 in % \) - . 0 9 ''; do
zformat -F REPLY '' $1:
done
-1:spec with illegal char
+1:spec with invalid char
?(eval):zformat:2: invalid spec: %:
?(eval):zformat:2: invalid spec: ):
?(eval):zformat:2: invalid spec: -:
--
2.38.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author