bash usage of fdescfs [was: Re: amd64/188699: Dev tree]
Jung-uk Kim
jkim at FreeBSD.org
Mon Apr 21 22:29:58 UTC 2014
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2014-04-21 18:00:30 -0400, Jung-uk Kim wrote:
2014년 4월 21일 18:00, Jung-uk Kim 쓴 글:> On 2014-04-21 17:46:32
- -0400, Bryan Drewery wrote:
>> On 2014-04-21 16:40, Konstantin Belousov wrote:
>>> On Mon, Apr 21, 2014 at 05:23:04PM -0400, John Baldwin wrote:
>>>> On Monday, April 21, 2014 3:51:33 pm Konstantin Belousov
>>>> wrote:
>>>>> On Mon, Apr 21, 2014 at 02:31:12PM -0400, John Baldwin
>>>>> wrote:
>>>>>> On Thursday, April 17, 2014 2:50:01 pm Konstantin
>>>>>> Belousov wrote:
>>>>>>> The following reply was made to PR amd64/188699; it
>>>>>>> has been
>>>> noted by GNATS.
>>>>>>>
>>>>>>> From: Konstantin Belousov <kostikbel at gmail.com> To:
>>>>>>> John Allman <freebsd at hugme.org> Cc:
>>>>>>> freebsd-gnats-submit at FreeBSD.org Subject: Re:
>>>>>>> amd64/188699: Dev tree Date: Thu, 17 Apr 2014 21:44:52
>>>>>>> +0300
>>>>>>>
>>>>>>> On Wed, Apr 16, 2014 at 05:32:45PM +0000, John Allman
>>>>>>> wrote:
>>>>>>>> This is how to reproduce it:
>>>>>>>>
>>>>>>>> Fresh install of 10 on AMD 64 install bash `pkg
>>>>>>>> install bash` Switch to bash `bash` push a here
>>>>>>>> document into a loop: `while true ; do echo;
>>>> done< <(echo "123")`
>>>>>>>> receive an error: "-su: /dev/fd/62: No such file or
>>>>>>>> directory"
>>>>>>>>
>>>>>>>> I'm sorry I haven't been able to research this any
>>>>>>>> further.
>>>> I found how while working on some important matters. As I
>>>> mentioned the above works fine in all
>>>>>> previous versions of FreeBSD up until 10.
>>>>>>>>> How-To-Repeat:
>>>>>>>> Fresh install pkg install bash bash while true; do
>>>>>>>> echo foo done< <(echo "123")
>>>>>>>>
>>>>>>>> -su: /dev/fd/62: No such file or directory
>>>>>>>
>>>>>>> So do you have fdescfs mounted on /dev/fd on the
>>>>>>> machine where
>>>> the
>>>>>>> test fails ? It works for me on head, and if
>>>>>>> unmounted, I get
>>>> the
>>>>>>> same failure message as yours. I very much doubt that
>>>>>>> it has
>>>> anything
>>>>>>> to do with a system version.
>>>>>>
>>>>>> Question I have is why is bash deciding to use
>>>>>> /dev/fd/<n> and
>>>> require
>>>>>> fdescfs? On older releases bash uses named pipes for
>>>>>> this instead.
>>>>>
>>>>> The aclocal.m4 contains the test which verifies the
>>>>> presence and
>>>> usability
>>>>> of /dev/fd/n for n>=3 on the _build_ host. The result of
>>>>> the test is used on the installation host afterward.
>>>>>
>>>>> Such kinds of bugs are endemic in our ports, but
>>>>> apparently upstreams are guilty too.
>>>>
>>>> Yuck, yuck. Should we fix our default package builders to
>>>> not mount fdescfs?
>>>
>>> IMO, using /dev/fd is more efficient since it avoids pipe
>>> inode creation for the 'document here' interpretation. The
>>> /dev/fd is also needed for fexecve(2) to work (with the shebang
>>> scripts). Also, I believe that some other high-profile ports
>>> require it (OpenJDK ?).
>>>
>>> That said, the solution is to have fdescfs mounted on /dev/fd.
>>> This probably should be done by an installer.
>
>> Yup, we mount it mostly for the java ports.
>
> Basically, OpenJDK uses it as poor man's closefrom(2). If
> necessary, we can drop the need for fdescfs from next revision as
> all supported FreeBSD versions have it.
Actually, java/openjdk6 also uses it for getOpenFileDescriptorCount().
http://docs.oracle.com/javase/7/docs/jre/api/management/extension/com/sun/management/UnixOperatingSystemMXBean.html
FYI, java/openjdk7 and java/openjdk8 (which is based on java/openjdk7
patches) are missing the implementation.
Sorry, it was long ago and I forget the detail. :-(
Jung-uk Kim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)
iQEcBAEBAgAGBQJTVZvlAAoJEHyflib82/FGmvwH+QH9paQz45GzytlG906i1qjF
0qEXGdTKFJaQ/gpiYq3McIv42GviGT4/bHIi2zGP1YjAf540TkageDuZM4Ia+pwK
/bN62msx+X/h1rjfUpLvNbjU312K3hEpyyWhK8omkpUMl8j9CtcWJve3qz4Tzjoh
q29qBMgRKBAIbuLywsLASmO5RzrFca4Dhz5ltuc9so6d4HF4Hu82L1tPy1H662L6
RSyyZ5Sv6YIViZQnXFq4Fl+k4uOtMlroYQbDbqdlWsMoYbsIn+CjgRPM7s+5iUNh
Ccst1EApwcmI2UUKIcnqwELCyk08Qnupl2MOa0OJiBmWwr52mryuUow7HLv8D1U=
=TNgt
-----END PGP SIGNATURE-----
More information about the freebsd-ports
mailing list