1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

POSIX: 'command': don't disable declaration proprts (re: b9d10c5a)

Following the resolution of Austin Group bug 1393[*] that is set to
be included in the next version of the POSIX standard, the
'command' prefix in POSIX mode (set -o posix) no longer disables
the declaration properties of declaration built-ins.
[*] https://austingroupbugs.net/view.php?id=1393

src/cmd/ksh93/sh/parse.c: lex():
- Skip the 'command' prefix even in POSIX mode so that any
  declaration commands prefixed by it are treated as such in xec.c
  (sh_exec()).

src/cmd/ksh93/sh/xec.c: sh_exec():
- The foregoing change reintroduced a variant of BUG_CMDSPEXIT: the
  shell exits on something like 'command export readonlyvar=foo'.
  This now fixes that bug for both POSIX and non-POSIX mode. When
  calling nv_setlist() to process true shell assignments, and there
  is a 'command' prefix, push a shell context and use sigsetjmp to
  intercept any errors in assignments and stop the shell exiting.

src/cmd/ksh93/tests/builtins.sh:
- Borrow the BUG_CMDSPEXIT regression test from modernish and adapt
  it for ksh. (I'm the author so yes, I can do this.) Original:
  ae8fe9c3/lib/modernish/tst/builtin.t (L80-L109)
This commit is contained in:
Martijn Dekker 2021-05-04 00:34:06 +01:00
parent 1a1e3709c2
commit d309d604e7
5 changed files with 50 additions and 12 deletions

View file

@ -5913,13 +5913,6 @@ executing the command as a regular built-in.
.I "option-name"
prevents a script from terminating when an invalid
option name is given.)
If
.I name\^
refers to a declaration built-in,
as marked with \fB\(dd\fR in this manual,
and the \fBposix\fR shell option is on,
then the declaration properties are removed so that arguments containing
\fB=\fR are not treated specially.
.IP
The
.B \-p
@ -7246,9 +7239,6 @@ disables the \fB&>\fR redirection shorthand;
.IP \[bu]
makes the \fB<>\fR redirection operator default to redirecting standard input
if no file descriptor number precedes it;
.IP \[bu]
causes the \fBcommand\fR utility to disable declaration command properties of
any declaration commands it invokes;
and
.IP \[bu]
disables a hack that makes \fBtest -t\fR (\fB[ -t ]\fR) equivalent to