Bug 981443 - wait vs. invalid pid/job spec: man page update OR wait builtin fix might be needed
wait vs. invalid pid/job spec: man page update OR wait builtin fix might be n...
Product: Fedora
Classification: Fedora
Component: bash (Show other bugs)
Unspecified Unspecified
low Severity low
: ---
: ---
Assigned To: Siteshwar Vashisht
BaseOS QE - Apps
Depends On:
  Show dependency treegraph
Reported: 2013-07-04 13:54 EDT by Jan Pokorný
Modified: 2018-05-29 07:57 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2018-05-29 07:57:53 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jan Pokorný 2013-07-04 13:54:08 EDT
Just noticed this discrepancy man page vs. reality:

> [...]
> 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.


> [...]
> All builtins return an exit status of 2 to indicate incorrect usage.


$ 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
Comment 2 Roman Rakus 2013-07-09 07:15:21 EDT
Looks like all (or majority) builtins return 1 on error. Easier is to change man page. Will ask upstream.
Comment 11 Siteshwar Vashisht 2017-01-18 11:21:03 EST
I presume this can be closed with manpage update from comment 7. Is it ok with you ?
Comment 12 Jan Pokorný 2017-01-19 11:04:31 EST
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.
Comment 13 Siteshwar Vashisht 2017-01-31 06:58:54 EST
Moving this bug to rawhide for further discussion.
Comment 14 Fedora End Of Life 2017-02-28 04:34:17 EST
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.
Comment 15 Fedora End Of Life 2018-05-03 04:15:40 EDT
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.
Comment 16 Fedora End Of Life 2018-05-29 07:57:53 EDT
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

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.