Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15065 > unrolled thread

File descriptor of process substitution unexpectedly persisting

Started by"" <kfm@plushkava.net>
First post2019-06-21 19:58 +0100
Last post2019-06-21 19:58 +0100
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.


Contents

  File descriptor of process substitution unexpectedly persisting "" <kfm@plushkava.net> - 2019-06-21 19:58 +0100

#15065 — File descriptor of process substitution unexpectedly persisting

From"" <kfm@plushkava.net>
Date2019-06-21 19:58 +0100
SubjectFile descriptor of process substitution unexpectedly persisting
Message-ID<mailman.609.1561150004.10840.bug-bash@gnu.org>
Hi,

As tested interactively with bash 5.0.7(1) and GNU/Linux, the following command prints a constant number of active file descriptors, as expected:

$ while :; do { read; } < <(:); sleep 0.5; printf %s\\n /proc/self/fd/* | wc -l; done
6
6
6
6
6
... etc

However, merely by assigning a variable prior to the loop, though within the same line, the number will continuously grow:

$ var=0; while :; do { read; } < <(:); sleep 0.5; printf %s\\n /proc/self/fd/* | wc -l; done
6
7
8
9
10
... etc

If then adjusted so that the read command is not part of a compound command, normality is restored:

$ var=0; while :; do read < <(:); sleep 0.5; printf %s\\n /proc/self/fd/* | wc -l; done
5
5
5
5
5
... etc

I noticed this behaviour upon running out of file descriptors after executing structurally similar code that deliberately utilises a compound command to read twice, thus discarding the first line of input.

-- 
Kerin Millar <kfm@plushkava.net>

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web