[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash process substitution does not work in FreeBSD 5.2.1 with devfs(
From: |
Reinhard Speyerer |
Subject: |
Re: bash process substitution does not work in FreeBSD 5.2.1 with devfs(5) |
Date: |
Wed, 06 Oct 2004 23:19:33 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031208 |
Chet Ramey wrote:
Reinhard Speyerer wrote:
[...]
Repeat-By:
# Check that devfs(5) is mounted on /dev and execute a command
# that uses process substitution.
$ mount | grep devfs
devfs on /dev (devfs, local)
$ diff <(cat /etc/group) <(cat /etc/group)
diff: /dev/fd/63: No such file or directory
diff: /dev/fd/62: No such file or directory
$ ls /dev/fd
0 1 2
[...]
Upgrade. Bash-3.0 tests for this at configure time.
Chet
The above results were obtained with
Bash Version: 3.0
Patch Level: 0
Release Status: release
and
FreeBSD 5.2.1.
The cause of the problem seems to be that FreeBSD changed from a static /dev
hierarchy in FreeBSD 4.x to a dynamically updated one via a devfs mount on /dev
and not updating /dev/fd entries accordingly when file descriptors are opened
as can be seen by the following example:
freebsd44$ sh
$ exec 9</dev/null && test -r /dev/fd/9
$ echo $?
0
$
freebsd521$ sh
$ ls -l /dev/fd
total 0
crw-rw-rw- 1 root wheel 22, 0 Oct 6 20:57 0
crw-rw-rw- 1 root wheel 22, 1 Oct 6 20:57 1
crw-rw-rw- 1 root wheel 22, 2 Oct 6 20:57 2
$ exec 9</dev/null && test -r /dev/fd/9
$ echo $?
1
$ ls -l /dev/fd
total 0
crw-rw-rw- 1 root wheel 22, 0 Oct 6 20:57 0
crw-rw-rw- 1 root wheel 22, 1 Oct 6 20:57 1
crw-rw-rw- 1 root wheel 22, 2 Oct 6 20:57 2
$
The bash configure script should probably be extended to include code similar to
the above in addition to the test -r /dev/fd/0 check when setting bash_cv_dev_fd.
Reinhard