diff options
author | Peter Stephenson <pws@zsh.org> | 2017-07-26 16:56:23 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2017-07-27 09:22:04 +0100 |
commit | d4b94b5e8388c744a1d879fecb5af957b170c4c1 (patch) | |
tree | 56352f47635ef1436e0669aa85f2f570d9d3aec7 /Src/exec.c | |
parent | 18c3c12bf0dc0fdbfb9ff79ebf90475a1dadc606 (diff) | |
download | zsh-d4b94b5e8388c744a1d879fecb5af957b170c4c1.tar.gz zsh-d4b94b5e8388c744a1d879fecb5af957b170c4c1.tar.xz zsh-d4b94b5e8388c744a1d879fecb5af957b170c4c1.zip |
41464, 41466: With POSIX_BUILTINS, exec only executes sexternal commands.
Document the default behaviour and add a test.
Diffstat (limited to 'Src/exec.c')
-rw-r--r-- | Src/exec.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c index 0a9687998..f339dd6d0 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -2778,6 +2778,12 @@ execcmd_exec(Estate state, Execcmd_params eparams, * Reserved words take precedence over shell functions. */ checked = 1; + } else if (isset(POSIXBUILTINS) && (cflags & BINF_EXEC)) { + /* + * POSIX doesn't allow "exec" to operate on builtins + * or shell functions. + */ + break; } else { if (!(cflags & (BINF_BUILTIN | BINF_COMMAND)) && (hn = shfunctab->getnode(shfunctab, cmdarg))) { @@ -3123,10 +3129,14 @@ execcmd_exec(Estate state, Execcmd_params eparams, * - we have determined there are options which would * require us to use the "command" builtin); or * - we aren't using POSIX and so BINF_COMMAND indicates a zsh - * precommand modifier is being used in place of the builtin + * precommand modifier is being used in place of the + * builtin + * - we are using POSIX and this is an EXEC, so we can't + * execute a builtin or function. */ if (errflag || checked || is_builtin || - (unset(POSIXBUILTINS) && (cflags & BINF_COMMAND))) + (isset(POSIXBUILTINS) ? + (cflags & BINF_EXEC) : (cflags & BINF_COMMAND))) break; cmdarg = (char *) peekfirst(args); |