Bug 1310004

Summary: set -e: not-found-command returns 1 while should 127
Product: [Fedora] Fedora Reporter: Van de Bugger <van.de.bugger>
Component: bashAssignee: Siteshwar Vashisht <svashisht>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: medium    
Version: 25CC: admiller, deekej, kdudka, ooprala
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-11 07:31:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Van de Bugger 2016-02-19 08:35:11 UTC
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 13:19:08 UTC
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 15:38:30 UTC
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 16:00:14 UTC
Still reproducible with bash-4.3.43-4.fc25.

Comment 4 Siteshwar Vashisht 2017-02-13 07:24:39 UTC
This was fixed by rebasing bash to version 4.4 in rawhide.