Bug 35599

Summary: bash3 -e fails to abort after an error in a while-loop after a pipe
Product: Sisyphus Reporter: Ivan Zakharyaschev <imz>
Component: bash3Assignee: placeholder <placeholder>
Status: NEW --- QA Contact: qa-sisyphus
Severity: normal    
Priority: P3 CC: glebfm, ldv, placeholder
Version: unstable   
Hardware: all   
OS: Linux   

Description Ivan Zakharyaschev 2018-11-13 07:32:47 MSK
It is expected that the shell aborts in such case, but bash3 doesn't:

$ sh -efu -c 'x=iii;  echo foo | while ! [ "$x" = "" ]; do x="${x%i}"; false; echo "$x"; done; echo "END: $?"'
END: 1
$ sh4 -efu -c 'x=iii;  echo foo | while ! [ "$x" = "" ]; do x="${x%i}"; false; echo "$x"; done; echo "END: $?"'
$ 

bash4 behaves as expected.

(I actually didn't notice an error in my script because of this...)

$ sh --version
GNU bash, version 3.2.57(1)-release (x86_64-alt-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
$ sh4 --version
GNU bash, version 4.3.42(1)-release (x86_64-alt-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$