summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Altherr <philippe.altherr@gmail.com>2026-02-16 16:05:39 -0800
committerBart Schaefer <schaefer@zsh.org>2026-02-16 16:05:39 -0800
commit7f1dec0bae0c7fb4fea32975e669e43c5c331ba7 (patch)
tree2dbf45b588c3be7273a0365fa7a8145e518be0e5
parent54063: Simplifications for resolve_nameref() and setscope() (diff)
downloadzsh-7f1dec0bae0c7fb4fea32975e669e43c5c331ba7.tar
zsh-7f1dec0bae0c7fb4fea32975e669e43c5c331ba7.tar.gz
zsh-7f1dec0bae0c7fb4fea32975e669e43c5c331ba7.tar.bz2
zsh-7f1dec0bae0c7fb4fea32975e669e43c5c331ba7.tar.lz
zsh-7f1dec0bae0c7fb4fea32975e669e43c5c331ba7.tar.xz
zsh-7f1dec0bae0c7fb4fea32975e669e43c5c331ba7.tar.zst
zsh-7f1dec0bae0c7fb4fea32975e669e43c5c331ba7.zip
54122: avoid warnings for valid nameref options
-rw-r--r--ChangeLog3
-rw-r--r--Src/builtin.c2
-rw-r--r--Test/K01nameref.ztst5
3 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9b980c170..3e687f112 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2026-02-16 Bart Schaefer <schaefer@zsh.org>
+ * Philippe: 54122: Src/builtin.c, Test/K01nameref.ztst: avoid
+ warnings for valid nameref options
+
* Philippe: 54063: Src/Modules/param_private.c, Src/builtin.c,
Src/params.c, Src/zsh.h, Test/K01nameref.ztst: Simplifications
for resolve_nameref() and setscope()
diff --git a/Src/builtin.c b/Src/builtin.c
index f0af07121..2bdbff8a6 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2713,7 +2713,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
else
continue;
if (OPT_MINUS(ops,'n')) {
- if ((on|off) & ~(PM_READONLY|PM_UPPER|PM_HIDEVAL)) {
+ if (bit & ~(PM_READONLY|PM_UPPER|PM_HIDEVAL)) {
zwarnnam(name, "-%c not allowed with -n", optval);
/* return 1; */
}
diff --git a/Test/K01nameref.ztst b/Test/K01nameref.ztst
index 8a2d0ffd7..e0f7b1879 100644
--- a/Test/K01nameref.ztst
+++ b/Test/K01nameref.ztst
@@ -1084,6 +1084,11 @@ F:previously this could create an infinite recursion and crash
1:create nameref by pattern match not allowed
*?*typeset:1: -m not allowed with -n
+ typeset -nariu ref=var
+1:regression: warn about invalid nameref options but never about valid ones
+*?*typeset:1: -a not allowed with -n
+*?*typeset:1: -i not allowed with -n
+
e -u 0
0:assignment at different scope than declaration, -u 0
>g:1: rs=f - ra=f - rs1=f - ra1=f