Bug 35599 - bash3 -e fails to abort after an error in a while-loop after a pipe
Summary: bash3 -e fails to abort after an error in a while-loop after a pipe
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: 2018-11-13 07:32 MSK by Ivan Zakharyaschev
Modified: 2018-12-19 01:47 MSK (History)
3 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 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.
$