status(p).permissions() and symlink_status(p).permissions() are not specifiedSection: 31.12.13.36 [fs.op.status], 31.12.13.38 [fs.op.symlink.status] Status: C++17 Submitter: Eric Fiselier Opened: 2016-06-19 Last modified: 2023-02-07
Priority: 0
View all other issues in [fs.op.status].
View all issues with C++17 status.
Discussion:
The current specification for status(p) and symlink_status(p)
omits any mention on setting permissions() on the returned file_status.
Obviously they should be set, but as currently specified the
permissions() will always be perms::unknown.
[2016-06, Oulu]
2720 is a related issue.
[2016-06 Oulu]
Moved to P0/Ready during issues prioritization.
Friday: status to Immediate
Proposed resolution:
This wording is relative to N4594.
Change 31.12.13.36 [fs.op.status] as indicated:
file_status status(const path& p, error_code& ec) noexcept;-4- Effects: If possible, determines the attributes of the file
-?- Letpresolves to, as if byPOSIXusing POSIXstat().stat()to obtain a POSIXstruct stat.. […]prmsdenote the result of(m & perms::mask), wheremis determined as if by converting thest_modemember of the obtainedstruct statto the typeperms. -5- Returns:
If
ec != error_code():
[…]
Otherwise
If the attributes indicate a regular file, as if by POSIX
S_ISREG, returnsfile_status(file_type::regular, prms). […]Otherwise, if the attributes indicate a directory, as if by POSIX
S_ISDIR, returnsfile_status(file_type::directory, prms). […]Otherwise, if the attributes indicate a block special file, as if by POSIX
S_ISBLK, returnsfile_status(file_type::block, prms).Otherwise, if the attributes indicate a character special file, as if by POSIX
S_ISCHR, returnsfile_status(file_type::character, prms).Otherwise, if the attributes indicate a fifo or pipe file, as if by POSIX
S_ISFIFO, returnsfile_status(file_type::fifo, prms).Otherwise, if the attributes indicate a socket, as if by POSIX
S_ISSOCK, returnsfile_status(file_type::socket, prms).Otherwise, returns
file_status(file_type::unknown, prms).
Change [fs.op.symlink_status] as indicated:
file_status symlink_status(const path& p); file_status symlink_status(const path& p, error_code& ec) noexcept;-1- Effects: Same as
-?- Letstatus(), above, except that the attributes ofpare determined as if byPOSIXusing POSIXlstat()lstat()to obtain a POSIXstruct stat.prmsdenote the result of(m & perms::mask), wheremis determined as if by converting thest_modemember of the obtainedstruct statto the typeperms. -2- Returns: Same asstatus(), above, except that if the attributes indicate a symbolic link, as if by POSIXS_ISLNK, returnsfile_status(file_type::symlink, prms). The signature with argumentecreturnsfile_status(file_type::none)if an error occurs.