Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15498 > unrolled thread
| Started by | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| First post | 2019-10-11 11:48 -0400 |
| Last post | 2019-10-11 11:48 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Bug when using pipefail and lastpipe together in bash-4.4 Chet Ramey <chet.ramey@case.edu> - 2019-10-11 11:48 -0400
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Date | 2019-10-11 11:48 -0400 |
| Subject | Re: Bug when using pipefail and lastpipe together in bash-4.4 |
| Message-ID | <mailman.346.1570808927.9715.bug-bash@gnu.org> |
On 10/8/19 9:43 AM, Webstrand wrote:
> When running the following script under bash-4.4.0 to bash-4.4.23 it
> seems to fail erroneously on read.
>
> set -x
> set -o pipefail
> shopt -s lastpipe
>
> main() {
> # Any input piped into while such that the condition
> # succeeds at least once.
> echo "x" | while read; do
> echo | read # anything piped to read
> sleep 0 # any non-builtin
> done
> }
>
> main || echo "main failed"
>
> This produces the xtrace:
>
> + set -o pipefail
> + shopt -s lastpipe
> + main
> + read
> + echo x
> + read
> + echo
> + sleep 0
> + read
> + echo 'main failed'
> main failed
>
> Under bash-4.3 and bash-5.0 the script does not output "main failed",
> as expected.
>
> I'm not sure if this is a known bug. One user on IRC reported finding
> the same issue on debian stretch, but another could not reproduce the
> issue for bash-4.4.12.
>
> I have bisected the history of the devel git branch and found that the commit:
> 85ec0778f9d778e1820fb8c0e3e996f2d1103b45 commit bash-20150417 snapshot
> introduces the issue.
>
> Applying the attached patch to a bash-4.4.23 source tree produces an
> interpreter which does not output "main failed" when running the
> aforementioned script.
It's pretty clear that that patch is not the determining factor, since that
code exists in bash-5.0 and the problem doesn't occur.
The actual fix probably came in in the bash-20180817 snapshot, as a result
of
https://savannah.gnu.org/support/index.php?109541
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
Back to top | Article view | gnu.bash.bug
csiph-web