Bug 1310004 - set -e: not-found-command returns 1 while should 127
set -e: not-found-command returns 1 while should 127
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: bash (Show other bugs)
25
x86_64 Linux
medium Severity low
: ---
: ---
Assigned To: Siteshwar Vashisht
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-19 03:35 EST by Van de Bugger
Modified: 2017-02-13 02:24 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-02-11 02:31:28 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Van de Bugger 2016-02-19 03:35:11 EST
Description of problem:

Bash manual says: if command is not found, it has exit status 127. That works as expected:

$ /non-existent || echo $?
bash: /non-existent: No such file or directory
127

Ok. However, after 'set -e' exist status of non-existent command is NOT 127 but 1:

$ set -e
$ /non-existent || echo $?
bash: /non-existent: No such file or directory
1

Resetting errexit option back to original value restores proper behavior:

$ set +e
$ /non-existent || echo $?
bash: /non-existent: No such file or directory
127

Version-Release number of selected component (if applicable):

Fedora 23 on x86_64
bash-4.3.42-3.fc23.x86_64

How reproducible:

Always

Steps to Reproduce:
1. /non-existent || echo $?
2. ( set -e; /non-existent || echo $? )

Actual results:

bash: /non-existent: No such file or directory
127

bash: /non-existent: No such file or directory
1

Expected results:

bash: /non-existent: No such file or directory
127

bash: /non-existent: No such file or directory
127

Additional info:

dash-0.5.8-3.fc23.x86_64 and zsh-5.1.1-4.fc23.x86_64 work correctly, they return 127 regardless of errexit option state.
Comment 1 Fedora Admin XMLRPC Client 2016-05-10 09:19:08 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 2 Fedora End Of Life 2016-11-24 10:38:30 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. 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 '23'.

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 23 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 3 Kamil Dudka 2016-11-24 11:00:14 EST
Still reproducible with bash-4.3.43-4.fc25.
Comment 4 Siteshwar Vashisht 2017-02-13 02:24:39 EST
This was fixed by rebasing bash to version 4.4 in rawhide.

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