Bug 255625 - fdescfs open with O_DIRECTORY fails with ENOTDIR
Summary: fdescfs open with O_DIRECTORY fails with ENOTDIR
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 13.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-05 17:54 UTC by walker.aj325
Modified: 2021-05-05 20:16 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description walker.aj325 2021-05-05 17:54:44 UTC
>> os.open("/mnt/dozer", os.O_DIRECTORY)
3
>>> os.open("/dev/fd/3", os.O_DIRECTORY)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NotADirectoryError: [Errno 20] Not a directory: '/dev/fd/3'
Manpage states:
     Flags to the open(2) call other than O_RDONLY, O_WRONLY and O_RDWR	are
     ignored.
Ideally, it would be nice to have O_DIRECTORY support.

The reason for this preference is that there are various places where Samba needs to be able to convert descriptors opened with O_PATH to regular opens, and it perform these opens with O_DIRECTORY if it is expected to be a directory.
Comment 1 Konstantin Belousov freebsd_committer freebsd_triage 2021-05-05 20:16:29 UTC
Try https://reviews.freebsd.org/D30131