mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-05-10 19:10:51 +02:00
53363: permit "typeset -n +m pattern"
Also fix spurious error printing the value of a read-only named reference
This commit is contained in:
parent
2e08ea1aef
commit
8701313c61
2 changed files with 10 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue