Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command now disables the special properties of special builtins #19

Merged
merged 1 commit into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Any uppercase BUG_* names are modernish shell bug IDs.
- Passing the '-d' flag to the read builtin will no longer cause the '-r'
flag to be discarded when 'read -r -d' is run.

- Fix BUG_CMDSPASGN: preceding a "special builtin"[*] with 'command' now
prevents preceding invocation-local variable assignments from becoming global.
[*] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_14

2020-06-15:

- The 'source' alias has been converted into a regular built-in command.
Expand Down
7 changes: 0 additions & 7 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/sh/xec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ int sh_exec(register const Shnode_t *t, int flags)
io = t->tre.treio;
if(shp->envlist = argp = t->com.comset)
{
if(argn==0 || (np && nv_isattr(np,(BLT_DCL|BLT_SPC))))
if(argn==0 || (np && (nv_isattr(np,BLT_DCL) || (!command && nv_isattr(np,BLT_SPC)))))
{
Namval_t *tp=0;
if(argn)
Expand Down
5 changes: 5 additions & 0 deletions src/cmd/ksh93/tests/builtins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -697,5 +697,10 @@ whence -q export) || err_exit '`builtin -d` deletes special builtins'
printf '\\\000' | read -r -d ''
[[ $REPLY == $'\\' ]] || err_exit "read -r -d '' ignores -r"

# ======
# Preceding a special builtin with `command` should disable its special properties
foo=BUG command eval ':'
[[ $foo == BUG ]] && err_exit '`command` fails to disable the special properties of special builtins'

# ======
exit $((Errors<125?Errors:125))