This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.

### 2728. `status(p).permissions()` and `symlink_status(p).permissions()` are not specified

Section: 31.12.13.36 [fs.op.status], 99 [fs.op.symlink_status] Status: C++17 Submitter: Eric Fiselier Opened: 2016-06-19 Last modified: 2017-07-30

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.

1. 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 `p` resolves to, as if by POSIX `stat()`.using POSIX `stat()` to obtain a POSIX `struct stat`.. […]

   > > -?- Let `prms` denote the result of `(m & perms::mask)`, where `m` is determined as if by converting the `st_mode` member of the obtained `struct stat` to the type `perms`.

   > > -5- Returns:

   > > - If `ec != error_code()`:

   > >   - […]

   > > - Otherwise

   > >   - If the attributes indicate a regular file, as if by POSIX `S_ISREG`, returns `file_status(file_type::regular, prms)`. […]

   > >   - Otherwise, if the attributes indicate a directory, as if by POSIX `S_ISDIR`, returns `file_status(file_type::directory, prms)`. […]

   > >   - Otherwise, if the attributes indicate a block special file, as if by POSIX `S_ISBLK`, returns `file_status(file_type::block, prms)`.

   > >   - Otherwise, if the attributes indicate a character special file, as if by POSIX `S_ISCHR`, returns `file_status(file_type::character, prms)`.

   > >   - Otherwise, if the attributes indicate a fifo or pipe file, as if by POSIX `S_ISFIFO`, returns `file_status(file_type::fifo, prms)`.

   > >   - Otherwise, if the attributes indicate a socket, as if by POSIX `S_ISSOCK`, returns `file_status(file_type::socket, prms)`.

   > >   - Otherwise, returns `file_status(file_type::unknown, prms)`.

2. Change 99 [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 `status()`, above, except that the attributes of `p` are determined as if by POSIX `lstat()` using POSIX `lstat()` to obtain a POSIX `struct stat`.

   > > -?- Let `prms` denote the result of `(m & perms::mask)`, where `m` is determined as if by converting the `st_mode` member of the obtained `struct stat` to the type `perms`.

   > > -2- Returns: Same as `status()`, above, except that if the attributes indicate a symbolic link, as if by POSIX `S_ISLNK`, returns `file_status(file_type::symlink, prms)`. The signature with argument `ec` returns `file_status(file_type::none)` if an error occurs.