[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash-5.1.16 fails to unlink named pipes if pipeline terminates prema
Re: bash-5.1.16 fails to unlink named pipes if pipeline terminates prematurely
Fri, 9 Sep 2022 11:23:06 -0400
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.1
On 9/9/22 3:11 AM, RVP wrote:
Bash Version: 5.1
Patch Level: 16
Release Status: release
On FreeBSD 13.1-RELEASE-p2, /dev/fd may not always be mounted,
therefore bash-5.1.16 is configured with `bash_cv_dev_fd=absent'.
In this situation, bash does not unlink named pipes used for
process-substitution when a pipeline terminates prematurely.
$ diff -u <(ls -l /usr/bin) <(ls -l /tmp) | head >/dev/null
$ ls -l /tmp/sh-np.*
prw------- 1 rvp wheel 0 8 Sep 22:52 /tmp/sh-np.N59YMr
prw------- 1 rvp wheel 0 8 Sep 22:52 /tmp/sh-np.S9X8Fr
Bash is out of the picture by the time the diff command dies due to
SIGPIPE. It performs word expansions, including process substitution,
and execs diff. It's no longer around to remove the named pipes.
This is one reason why bash prefers to use /dev/fd if it's available.
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU firstname.lastname@example.org http://tiswww.cwru.edu/~chet/