fopen mode string issuesAuthors: Joseph Myers
Date: 2026-08-27
Submitted against: C2Y (N3886 draft)
Status: Open
Reflector message
26283 notes various
issues with the specification for fopen mode strings that remain
after the integration of
N3247
(and the subsequent
N3275
for fopen_s).
'+' needs updating to reflect that it might not
be the second or third character any more with relaxed ordering; it
could be any character after the first. This could probably be
fixed editorially by saying "a" in place of "the second or third".'p' is
inadequate, because "cannot be accessed by other means" would seem
to exclude all the suggested implementation strategies; O_TMPFILE
or a suid helper doesn't prevent access via /proc/self/fd/, for
example, or by direct privileged access to the underlying device.
It may be that this is a case where the normative wording can only
be understood to refer to mechanisms within the scope of the
standard, however, and as with memset_explicit not all the intent
about what is or is not an appropriate implementation strategy can
be expressed within the concepts usable in normative wording in
terms of the abstract machine. The normative wording should
probably be reworded to avoid saying things that cannot be
implemented, and further matters of intent moved to Recommended
Practice. Unlike the first three issues, the problematic wording
appears for fopen_s as well as for fopen. I tend to think that
it would be best for the fopen_s specification to say as little
as possible about the semantics of 'x' and 'p', deferring
instead to the fopen specification as far as possible.Comment from Issues list maintainer on 2026-11-25:
This issue was discussed at the November 2026 (Búzios) meeting of WG14. Niall Douglas took an action item to propose wording for this, and subsequently provided an initial draft of a paper on the subject in reflector message 38636.