Just noticed this discrepancy man page vs. reality: > SHELL BUILTIN COMMANDS > [...] > wait [n ...] > [...] the return status is zero. [...] the return status is 127. > Otherwise, the return status is the exit status of the last > process or job waited for. plus > EXIT STATUS > [...] > All builtins return an exit status of 2 to indicate incorrect usage. vs. $ wait foo; echo $? > -bash: wait: `foo': not a pid or valid job spec > 1 As per man page, I would expect the above command to be instance of incorrect usage (as no additional possibility is enumerated at the wait description), hence would expect 2 to be the exit status. Apparently, there is an inherent danger of exit status aliasing when the last process or job waited for exits with 1 (or 2). Using 2 instead of 1 would IMHO be (to limited extent) safer in this regard, as quite common C-based program's logic is to use just 0 (EXIT_SUCCESS) and 1 (EXIT_FAILURE).
Looks like all (or majority) builtins return 1 on error. Easier is to change man page. Will ask upstream.
I presume this can be closed with manpage update from comment 7. Is it ok with you ?
Well, the expected outcome really is that wait builtin in bash won't return 1 because of the common failure exit code aliasing issue described in [comment 0]. Reading http://pubs.opengroup.org/onlinepubs/9699919799/utilities/wait.html my intepretation is that it would be entirely OK if it returned 127 in case of nonsensical PID operand. The referred man page update is no remedy here, I am afraid.
Moving this bug to rawhide for further discussion.
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle. Changing version to '26'.
This message is a reminder that Fedora 26 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 26. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '26'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 26 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.