https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83625

            Bug ID: 83625
           Summary: std::experimental::filesystem::remove lstat()'s before
                    remove() instead of checking errno
           Product: gcc
           Version: 7.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chillermillerlong at hotmail dot com
  Target Milestone: ---

libstdc++'s std::experimental::filesystem::remove() function currently seems to
be doing an lstat() to check if the path exists before calling remove().
(https://github.com/gcc-mirror/gcc/blob/gcc-7_2_0-release/libstdc%2B%2B-v3/src/filesystem/ops.cc#L1235-L1249)

This could cause the function to report an error if the path is deleted between
the stat() and remove() instead of returning false. Would it make sense to
always attempt remove() and return false if errno == ENOENT instead?

Reply via email to