diff --git a/ChangeLog b/ChangeLog index 990509ae1..05aa89c88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-02-15 Bart Schaefer <schaefer@zsh.org> + + * 53363: Src/builtin.c: permit "typeset -n +m pattern" + + * unposted: Src/builtin.c: fix spurious error printing the value + of a read-only named reference + 2025-02-13 Oliver Kiddle <opk@zsh.org> * 53358: Completion/Zsh/Command/_typeset: adapt completion to diff --git a/Src/builtin.c b/Src/builtin.c index 2fab73b24..6bdaddff0 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -2254,7 +2254,7 @@ typeset_single(char *cname, char *pname, Param pm, int func, /* It seems as though these checks should not be specific to * PM_NAMEREF, but changing that changes historic behavior */ ((on & PM_NAMEREF) != (pm->node.flags & PM_NAMEREF) || - (asg && (pm->node.flags & PM_NAMEREF)))) { + (asg && (pm->node.flags & PM_NAMEREF))) && !OPT_ISSET(ops,'p')) { zerrnam(cname, "%s: read-only %s", pname, (pm->node.flags & PM_NAMEREF) ? "reference" : "variable"); return NULL; @@ -3053,12 +3053,11 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func) /* With the -m option, treat arguments as glob patterns */ if (OPT_ISSET(ops,'m')) { if (!OPT_ISSET(ops,'p')) { - if (on & PM_NAMEREF) { + if ((on & PM_NAMEREF) && OPT_MINUS(ops,'m')) { /* It's generally unwise to mass-change the types of * parameters, but for namerefs it would be fatal */ unqueue_signals(); - zerrnam(name, "%cm not allowed with -n", - (OPT_PLUS(ops,'m') ? '+' : '-')); + zerrnam(name, "-m not allowed with -n"); return 1; } if (!(on|roff))