Page MenuHomeFreeBSD

linux: implement O_PATH
ClosedPublic

Authored by trasz on Apr 15 2021, 12:49 PM.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Is there a Linux test suite for O_PATH? If yes, did you run it over this implementation?

sys/compat/linux/linux_file.h
86

Octal?! This is crazy. Does glibc header use octal for O_ constants?

Also can you commit addition of '0' separately?

This revision is now accepted and ready to land.Apr 15 2021, 12:55 PM
In D29773#667845, @kib wrote:

Is there a Linux test suite for O_PATH? If yes, did you run it over this implementation?

I didn't find any tests; what I did was a quick smoke test with Python:

>>> import os
>>> fd = os.open('/etc/passwd', os.O_RDONLY | os.O_PATH)
>>> os.read(fd, 5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 9] Bad file descriptor
>>> os.fstat(fd)
os.stat_result(st_mode=33188, st_ino=13324429, st_dev=112, st_nlink=1, st_uid=0, st_gid=0, st_size=2108, st_atime=1612790821, st_mtime=1612790821, st_ctime=1612790821)
sys/compat/linux/linux_file.h
86

It is sad, and yes, that's what you'll find in glibc headers. Sure I can!

This revision was automatically updated to reflect the committed changes.