mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
The >;word and <>;word redirection operators cannot be used with the 'exec' builtin, but the 'redirect' builtin (which used to be an alias of 'command exec') permitted them. However, they do not have the documented effect of the added ';'. So this commit blocks those operators for 'redirect' as they are blocked for 'exec'. It also tweaks redirect's error message if a non-redirection argument is encountered. src/cmd/ksh93/sh/parse.c: simple(): - Set the lexp->inexec flag for SYSREDIR (redirect) as well as SYSEXEC (exec). This flag is checked for in sh_lex() (lex.c) to throw a syntax error if one of these two operators is used. src/cmd/ksh93/sh.1, src/cmd/ksh93/data/builtins.c: - Documentation tweaks. src/cmd/ksh93/sh/xec.c, src/cmd/ksh93/bltins/misc.c: - When 'redirect' gives an 'incorrect syntax' (e_badsyntax) error message, include the first word that was found not to be a valid redirection. This is simply the first argument, as redirections are removed from the arguments list. src/cmd/ksh93/tests/io.sh: - Update test to reflect new error message format.
This commit is contained in:
parent
43dfe3c8fa
commit
403e864ac8
6 changed files with 21 additions and 15 deletions
|
@ -528,7 +528,7 @@ actual=$(redirect 2>&- 3>&2; echo ok)
|
|||
[[ $actual == ok ]] || err_exit "redirection error in 'redirect' causes exit"
|
||||
|
||||
# Test that 'redirect' does not accept non-redir args
|
||||
expect=$'*: redirect: incorrect syntax\n status = 2'
|
||||
expect=$'*: redirect: incorrect syntax: /dev/null/foo\n status = 2'
|
||||
actual=$( (redirect /dev/null/foo) 2>&1; echo " status = $?" );
|
||||
[[ $actual == $expect ]] || err_exit 'redirect command accepts non-redirection argument' \
|
||||
"(expected $(printf %q "$expect"), got $(printf %q "$actual"))"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue