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.
Section: 31.12.13.32 [fs.op.remove.all] Status: C++17 Submitter: Eric Fiselier Opened: 2016-05-28 Last modified: 2021-06-06
Priority: 3
View all issues with C++17 status.
Discussion:
The current post condition for remove_all(p, [...]) states:
Postcondition: !exists(p)
This is not correct when p is a symlink, since !exists(p) reads through the symlink. The postcondition should be changed to match that of remove which states !exists(symlink_status(p)).
[2016-06, Oulu — Eric clarifies the importance of the suggested change]
With the current post conditions remove_all(p) could just not remove dangling symlinks and still meet the post conditions.
Moved to Ready after Eric convinced the room.
Friday: status to Immediate
Proposed resolution:
This wording is relative to N4582.
Change [fs.op.remove_all] as indicated:
uintmax_t remove_all(const path& p); uintmax_t remove_all(const path& p, error_code& ec) noexcept;-1- Effects: Recursively deletes the contents of p if it exists, then deletes file p itself, as if by POSIX remove().
-2- [Note: A symbolic link is itself removed, rather than the file it resolves to being removed. — end note] -3- Postcondition: !exists(symlink_status(p)).