Bug 33487

Summary: buggy treatment of curly braces after pipe if it should fail
Product: Sisyphus Reporter: Ivan Zakharyaschev <imz>
Component: bash3Assignee: placeholder <placeholder>
Status: NEW --- QA Contact: qa-sisyphus
Severity: normal    
Priority: P3 CC: glebfm, ldv, obirvalger, placeholder, vseleznv
Version: unstable   
Hardware: all   
OS: Linux   

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'
$