Bug 33487 - buggy treatment of curly braces after pipe if it should fail
Summary: buggy treatment of curly braces after pipe if it should fail
Status: NEW
Alias: None
Product: Sisyphus
Classification: Development
Component: bash3 (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-17 22:22 MSK by Ivan Zakharyaschev
Modified: 2018-12-19 01:51 MSK (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zakharyaschev 2017-05-17 22:22:12 MSK
$ rpm -q bash
bash-3.2.57-alt1
$ bash -c 'set -e; set -o pipefail; cat </non-existing-file | cat; echo end'
bash: /non-existing-file: No such file or directory
$ bash -c 'set -e; set -o pipefail; cat </non-existing-file | { cat; }; echo end'
bash: /non-existing-file: No such file or directory
end
$ 

They should behave the same. In bash4, it's correct:

$ rpm -q bash4
bash4-4.2.50-alt1.1
$ bash4 -c 'set -e; set -o pipefail; cat </non-existing-file | { cat; }; echo end'
bash4: /non-existing-file: No such file or directory
$ bash4 -c 'set -e; set -o pipefail; cat </non-existing-file | cat; echo end'
bash4: /non-existing-file: No such file or directory
$
Comment 1 Ivan Zakharyaschev 2017-05-18 12:31:13 MSK
A simpler test-case:

$ bash -c 'set -e; set -o pipefail; false | cat; echo end'
$ bash -c 'set -e; set -o pipefail; false | { cat; }; echo end'
end
$ rpm -q bash
bash-3.2.57-alt1
$ 

Correct behavior:

$ bash4 -c 'set -e; set -o pipefail; false | { cat; }; echo end'
$ bash4 -c 'set -e; set -o pipefail; false | cat; echo end'
$ rpm -q bash4
bash4-4.2.50-alt1.1
$
Comment 2 Ivan Zakharyaschev 2017-05-18 12:40:50 MSK
A simpler test-case:

$ bash -c 'set -e; set -o pipefail; false | { true; }; echo end'
end
$ bash -c 'set -e; set -o pipefail; false | true; echo end'
$ 

$ bash4 -c 'set -e; set -o pipefail; false | { true; }; echo end'
$ bash4 -c 'set -e; set -o pipefail; false | true; echo end'
$