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

Fix assignments preceding 'command <special builtin>' (#19)

Ksh was not checking for `command` when running a special builtin,
which caused preceding invocation-local variable assignments to
become global. This is the reproducer from the att/ast#72:

$ foo=BUG command eval ':'
$ echo "$foo"

This no longer prints 'BUG', as ksh now makes sure the command builtin
is not running a special builtin before making invocation-local
variable assignments global.

src/cmd/ksh93/sh/xec.c:
 - Backport the bugfix for BUG_CMDSPASGN from ksh93v- 2013-10-10-alpha.

src/cmd/ksh93/tests/builtins.sh:
 - Add a regression test based on the reproducer in att/ast#72.
This commit is contained in:
Johnothan King 2020-06-16 14:58:05 -07:00 committed by GitHub
parent c258a04f7a
commit fae8862c53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 8 deletions

7
TODO
View file

@ -13,9 +13,6 @@ Fix build system:
- Reimport the removed nmake. It is necessary for changes in Makefiles
to take effect. The machine-generated Mamfiles are now used as a fallback,
but they are not meant to be edited by hand.
- Reimport the removed pty command (for scripting interactive sessions). This
is necessary for the pty.sh regression tests to work, which test ksh as an
interactive shell. We want to avoid breaking the interactive shell, too.
______
Fix or remove broken or misguided default aliases:
@ -59,10 +56,6 @@ https://github.com/modernish/modernish/tree/0.16/lib/modernish/cap/
don't work.
See also: https://github.com/att/ast/issues/963
- BUG_CMDSPASGN: preceding a "special builtin"[*] with 'command' does not
stop preceding invocation-local variable assignments from becoming global.
[*] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_14
- BUG_CMDSPEXIT: preceding a "special builtin"[*] (other than 'eval', 'exec',
'return' or 'exit') with 'command' does not always stop it from exiting
the shell if the builtin encounters error.