From 71b747567e350c5f849897c424ea76fd05b34ffe Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sun, 18 Apr 2021 14:26:12 -0700 Subject: 47704: POSIX export and readonly ignore "-p" when parameter names also appear --- Src/builtin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Src/builtin.c') diff --git a/Src/builtin.c b/Src/builtin.c index 6d119f7a5..efa20607e 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -2615,7 +2615,12 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func) int on = 0, off = 0, roff, bit = PM_ARRAY; int i; int returnval = 0, printflags = 0; - int hasargs; + int hasargs = *argv != NULL || (assigns && firstnode(assigns)); + + /* POSIXBUILTINS is set for bash/ksh and both ignore -p with args */ + if ((func == BIN_READONLY || func == BIN_EXPORT) && + isset(POSIXBUILTINS) && hasargs) + ops->ind['p'] = 0; /* hash -f is really the builtin `functions' */ if (OPT_ISSET(ops,'f')) @@ -2695,7 +2700,6 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func) /* -p0 treated as -p for consistency */ } } - hasargs = *argv != NULL || (assigns && firstnode(assigns)); if (!hasargs) { int exclude = 0; if (!OPT_ISSET(ops,'p')) { -- cgit 1.4.1