mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-25 08:34:36 +00:00
The 'command' name can now result from an expansion, e.g.: c=command; "$c" ls set -- command ls; "$@" both work now. This fixes BUG_CMDEXPAN. If -o posix is on, 'command' now disables not only the "special" but also the "declaration" properties of builtin commands that it invokes. This is because POSIX specifies 'command' as a simple regular builtin, and any command name following 'command' is just an argument to the 'command' command, so there is nothing that allows any further arguments (such as assignment-arguments) to be treated specially by the parser. So, if and only if -o posix is on: a. Arguments that start with a variable name followed by '=' are always treated as regular words subject to normal shell syntax. b. Since assignment-arguments are not processed as assignments before the command itself, 'command' can now stop the shell from exiting (as required by the standard) if a command that it invokes (such as 'export') tries to modify a readonly variable. This fixes BUG_CMDSPEXIT. Most of 'command' is integrated in the parser and parse tree executer, so that is where it needed fixing. src/cmd/ksh93/sh/parse.c: simple(): - If the posix option is on, do not skip past SYSCOMMAND so that any declaration builtin commands that are arguments to 'command' are not detected and thus not treated specially at parsetime. src/cmd/ksh93/sh/xec.c: sh_exec(): - When detecting SYSCOMMAND in order to skip past it, not only compare the Namval_t pointer 'np' to SYSCOMMAND, but also handle the case where that pointer is NULL, as when the command name results from an expansion. In that case, search the function tree shp->fun_tree for the name and see if that yields the SYSCOMMAND pointer. fun_tree is initialised with a dtview to bltin_tree, so searching fun_tree instead allows for overriding 'command' with a shell function (which the POSIX standard requires us to allow). src/cmd/ksh93/sh.1, src/cmd/ksh93/data/builtins.c: - Update documentation to match these changes. - Various related edits and improvements. src/cmd/ksh93/tests/builtins.sh: - Check that 'command' works if resulting from an expansion. - Check that 'command' can be overridden by a shell function. |
||
---|---|---|
.. | ||
alias.sh | ||
append.sh | ||
arith.sh | ||
arrays.sh | ||
arrays2.sh | ||
attributes.sh | ||
basic.sh | ||
bracket.sh | ||
builtins.sh | ||
case.sh | ||
comvar.sh | ||
comvario.sh | ||
coprocess.sh | ||
cubetype.sh | ||
enum.sh | ||
exit.sh | ||
expand.sh | ||
functions.sh | ||
glob.sh | ||
grep.sh | ||
heredoc.sh | ||
io.sh | ||
leaks.sh | ||
locale.sh | ||
math.sh | ||
nameref.sh | ||
namespace.sh | ||
options.sh | ||
path.sh | ||
pointtype.sh | ||
pty.sh | ||
quoting.sh | ||
quoting2.sh | ||
readcsv.sh | ||
recttype.sh | ||
restricted.sh | ||
return.sh | ||
select.sh | ||
shtests | ||
sigchld.sh | ||
signal.sh | ||
statics.sh | ||
subshell.sh | ||
substring.sh | ||
tilde.sh | ||
timetype.sh | ||
treemove.sh | ||
types.sh | ||
variables.sh | ||
vartree1.sh | ||
vartree2.sh |