From: meator <meator.dev@gmail.com>
To: mtk.manpages@gmail.com, alx.manpages@gmail.com
Cc: linux-man@vger.kernel.org
Subject: Request for clarification of O_PATH in open(2)
Date: Fri, 15 Apr 2022 19:48:19 +0200 [thread overview]
Message-ID: <20220415194819.5cb80c4b@PC> (raw)
[-- Attachment #1: Type: text/plain, Size: 1635 bytes --]
Hello. I was reading open(2) and I have noticed an interesting statement: "The argument flags must include one of the following access modes: O_RDONLY, O_WRONLY, or O_RDWR." Must one of these flags be specified when O_PATH is in use?
O_PATH description says that "Opening a file or directory with the O_PATH flag requires no permissions on the object itself (but does require execute permission on the directories in the path prefix)." I think that this can be a little bit ambiguous. When I first read it, I have thought that this sentence talks about filesystem permissions required on the file, not the access modes.
O_PATH description states that: "When O_PATH is specified in flags, flag bits other than O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW are ignored." One could think that you must specify an access mode, but it will be ignored.
The O_PATH description actually mentions the O_RDONLY flag, but it compares the difference of opening a file with O_PATH and opening it with (only) O_RDONLY, it doesn't mention the need of O_RDONLY flag when opening a file with O_PATH.
The only part of the manpage that clearly states that using access modes with O_PATH is not mandatory is the code sample included in the O_PATH description, which calls open("some_prog", O_PATH); (but this code sample covers another aspect of O_PATH).
Maybe I'm just dumb and I misread some of the text, but I think this can be ambiguous. I would have sent a patch fixing this, but I'm not a native English speaker and I don't actually know how open() works, so I don't want to make a mistake when modifying its manpage.
Thanks in advance,
Meator
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next reply other threads:[~2022-04-15 17:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-15 17:48 meator [this message]
2022-04-25 20:49 ` Request for clarification of O_PATH in open(2) Alejandro Colomar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220415194819.5cb80c4b@PC \
--to=meator.dev@gmail.com \
--cc=alx.manpages@gmail.com \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.