process substitution bug or difference from bash 4.4
From:
Valentin Lab
Subject:
process substitution bug or difference from bash 4.4
Date:
Wed, 25 Mar 2020 15:35:57 +0100
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1
Hi,
I have encountered an issue when running some bash code from 4.4 on a
bash 5 ... I've managed to pinpoint the exact issue on my end.
Here are 2 functions that are quite similar, except the usage of "{ ; }"
around the "cat":
## ----------------
ouch() {
cat < <(echo bar)
cat "$1"
}
ouch2() {
{ cat; } < <(echo bar)
cat "$1"
}
##----------------
Runnning this will give the same output on bash 4.4 and 5:
$ ouch <(echo "foo")
foo
bar
And by replacing "ouch" by "ouch2", I have the same output in bash 4.4 .
But running it on bash 5 will fail:
$ ouch2 <(echo "foo")
bar
cat: /dev/fd/63: No such file or directory
Is that expected ? I'd be happy to know about the rationale behind this
(and the change) if this is expected.