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.
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, andsetuid/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;[…]
[…]
[…]
(4.2) — Otherwise, copy the contents, permissions, and data modification time
and attributesof the filefrom
resolves to, to the fileto
resolves to, if:[…]
(4.2.3) —
(options & copy_options::update_existing) != copy_options::none
andfrom
is more recent thanto
, determined as if by use of thelast_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.
[…]