1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-05 11:01:13 +02:00

28866: with POSIX_BUILTINS "command" prefix resets specialness

This commit is contained in:
Peter Stephenson 2011-03-06 21:37:38 +00:00
parent 1a3612f119
commit 7bc97b920b
3 changed files with 18 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2011-03-06 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 28866: Src/exec.c, Test/A04redirect.ztst: With POSIX_BUILTINS,
"command" prefix tops a command having special behaviour.
2011-03-05 Barton E. Schaefer <schaefer@zsh.org>
* Adrian: 28857: Functions/Prompts/prompt_bigfade_setup: use %d
@ -14297,5 +14302,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5215 $
* $Revision: 1.5216 $
*****************************************************

View file

@ -2324,7 +2324,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
int nullexec = 0, assign = 0, forked = 0;
int is_shfunc = 0, is_builtin = 0, is_exec = 0, use_defpath = 0;
/* Various flags to the command. */
int cflags = 0, checked = 0, oautocont = -1;
int cflags = 0, orig_cflags = 0, checked = 0, oautocont = -1;
LinkList redir;
wordcode code;
Wordcode beg = state->pc, varspc;
@ -2416,6 +2416,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
checked = !(cflags & BINF_BUILTIN);
break;
}
orig_cflags |= cflags;
cflags &= ~BINF_BUILTIN & ~BINF_COMMAND;
cflags |= hn->flags;
if (!(hn->flags & BINF_PREFIX)) {
@ -3298,11 +3299,13 @@ execcmd(Estate state, int input, int output, int how, int last1)
done:
if (isset(POSIXBUILTINS) &&
(cflags & (BINF_PSPECIAL|BINF_EXEC))) {
(cflags & (BINF_PSPECIAL|BINF_EXEC)) &&
!(orig_cflags & BINF_COMMAND)) {
/*
* For POSIX-compatible behaviour with special
* builtins (including exec which we don't usually
* classify as a builtin) we treat all errors as fatal.
* The "command" builtin is not special so resets this behaviour.
*/
if (redir_err || errflag) {
if (!isset(INTERACTIVE)) {

View file

@ -383,6 +383,13 @@
set >/nonexistent/nonexistent
echo output'
1:failed special builtin redir, POSIX_BUILTINS
?zsh:2: no such file or directory: /nonexistent/nonexistent
$ZTST_testdir/../Src/zsh -f -o POSIX_BUILTINS -c '
command set >/nonexistent/nonexistent
echo output'
0:failed special builtin redir with command prefix, POSIX_BUILTINS
>output
?zsh:2: no such file or directory: /nonexistent/nonexistent
$ZTST_testdir/../Src/zsh -f -o POSIX_BUILTINS -c '