Bug 981443 - wait vs. invalid pid/job spec: man page update OR wait builtin fix might be needed
Summary: wait vs. invalid pid/job spec: man page update OR wait builtin fix might be n...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: bash
Version: 26
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
Assignee: Siteshwar Vashisht
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-04 17:54 UTC by Jan Pokorný [poki]
Modified: 2018-05-29 11:57 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-29 11:57:53 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jan Pokorný [poki] 2013-07-04 17:54:08 UTC
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).

Comment 2 Roman Rakus 2013-07-09 11:15:21 UTC
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 16:21:03 UTC
I presume this can be closed with manpage update from comment 7. Is it ok with you ?

Comment 12 Jan Pokorný [poki] 2017-01-19 16:04:31 UTC
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 11:58:54 UTC
Moving this bug to rawhide for further discussion.

Comment 14 Fedora End Of Life 2017-02-28 09:34:17 UTC
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 08:15:40 UTC
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 11:57:53 UTC
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.


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