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

3056. copy_file() copies which attributes?

Section: 31.12.13.5 [fs.op.copy.file] Status: New Submitter: Davis Herring Opened: 2018-01-26 Last modified: 2020-09-06

Priority: 3

View all other issues in [fs.op.copy.file].

View all issues with New status.

Discussion:

(To resolve C++17 CD comment Late 25.) It is not stated which attributes are copied by copy_file().

[2018-1-26 issues processing telecon]

Priority 3

Proposed resolution:

This wording is relative to N4713.

  1. Modify 31.12.13.5 [fs.op.copy.file] as indicated:

    Rationale:

    The attributes specified are the useful subset of the attributes that can be queried in C++17. Existing practice is complicated: POSIX "cp -p" attempts to preserve user/group IDs, for instance, but cannot in general do so, and setuid/setgid permissions may be stripped.

    bool copy_file(const path& from, const path& to, copy_options options);
    bool copy_file(const path& from, const path& to, copy_options options,
                   error_code& ec) noexcept;
    

    […]

    1. […]

    2. (4.2) — Otherwise, copy the contents, permissions, and data modification time and attributes of the file from resolves to, to the file to resolves to, if:

    3. […]

      1. (4.2.3) — (options & copy_options::update_existing) != copy_options::none and from is more recent than to, determined as if by use of the last_write_time function (31.12.13.26 [fs.op.last.write.time]).

      Other implementation-defined attributes may be copied. Failure (or partial failure) to copy attributes is not an error.

    4. […]

    […]