On Thu, Aug 18, 2022 at 12:30:21PM +0200, Laszlo Ersek wrote:
On 08/18/22 11:53, Richard W.M. Jones wrote:
>
> This is upstream in 5 commits 5764fa6f4..dd28b0054:
>
>
https://gitlab.com/nbdkit/nbdkit/-/commit/2620d95a4585204f0db0d55c0d41276...
>
https://gitlab.com/nbdkit/nbdkit/-/commit/185e7d4010b353f36b5ca5d47467a77...
>
https://gitlab.com/nbdkit/nbdkit/-/commit/17655b1ca67caa454e7a4ac83bc8c05...
>
https://gitlab.com/nbdkit/nbdkit/-/commit/e7fdffde8142fb083625678b7a55455...
>
https://gitlab.com/nbdkit/nbdkit/-/commit/dd28b005430d020ccd1825437937c31...
>
> This also includes dirfd functionality and a rather complicated test
> for that. Turns out that bash refuses to open a directory as a file
> descriptor :-(
This doesn't match my experience; for me, bash opens e.g. /tmp just fine
on both RHEL7 and Fedora35 -- but it must be a read-only open.
$ exec 9</tmp
[ok]
$ exec 9<>/tmp
bash: /tmp: Is a directory
Yep, POSIX forbids opening a directory with O_RDWR or O_WRONLY. But
just because a directory fd is read-only (we could also permit a
directory that was opened with O_SEARCH instead of O_RDONLY - except
that Linux O_SEARCH/O_EXEC support isn't quite yet in line with POSIX)
doesn't mean h->read_only should be set, because the read-only status
of the directory does not necessarily apply to files within the
directory.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization:
qemu.org |
libvirt.org