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

Bash and Zsh not POSIX on exec calls #41

Open
smondet opened this issue Feb 2, 2017 · 1 comment
Open

Bash and Zsh not POSIX on exec calls #41

smondet opened this issue Feb 2, 2017 · 1 comment
Labels

Comments

@smondet
Copy link
Member

smondet commented Feb 2, 2017

The exec Schism

Specification of exec.

If command is specified, exec shall not return to the shell; rather, the exit
status of the process shall be the exit status of the program implementing
command, which overlaid the shell. If command is not found, the exit status
shall be 127. If command is found, but it is not an executable utility, the
exit status shall be 126. If a redirection error occurs (see
Consequences of Shell Errors),
the shell shall exit with a value in the range 1-125
.
Otherwise, exec shall return a zero exit status.

For a given shell, trying:

$shell -c ' exec 4>&3 ; echo "Exec-returns: $?"' ; echo "Shell-returns: $?"

The POSIX ones:

  • shell=dash, shell=sh, shell='busbox ash': Shell-returns: 2
  • shell=ksh, shell=mksh: Shell-returns: 1

The non-POSIX ones:

  • shell=bash, shell=zsh:
    Exec-returns: 1 Shell-returns: 0
smondet added a commit that referenced this issue Feb 2, 2017
@smondet
Copy link
Member Author

smondet commented Jul 23, 2018

It seems that busybox 1.22 returns 2 while 1.27 returns 1 (both are ok with POSIX). This makes the "redirect-fails" test fail.

smondet added a commit that referenced this issue Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant