On 9/6/19 7:15 PM, Kamil Cukrowski wrote: > Bash Version: 5.0 > Patch Level: 9 > Release Status: release > > Description: > I have the following script to synchronize execution of a command > substitution using flock: > > touch /tmp/1 > echo | > ( > flock 13 > tee >( > cat > flock -u 13 > ) >/dev/null > ( > flock 13 > ) 13</tmp/1 > ) 13</tmp/1 > > The purpose of the code is to synchronize the output of the command > redirection run "inside" `tee` with the rest of the script. For that, the > "main process" blocks on flock until the command inside redirection is > finished when it unlocks the flock. > > However on bash 5.0 The `cat` inside `tee` gets blocked on `read()`.
Thanks for the report. It's the second `flock 13', because it still has a file descriptor open for writing on the pipe. The change between bash-4.4 and bash-5.0 was made in December, 2017 in response to this: https://lists.gnu.org/archive/html/bug-bash/2017-12/msg00002.html There was an asymmetry in the code that caused some instances of command lists to inherit file descriptors from process substitutions performed earlier in the list. The only thing that fixing that sacrifices is something like f=<(echo a); cat "$f" but that never worked in previous versions of bash anyway. The fix will be in the next devel branch push. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/