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

            Bug ID: 118733
           Summary: std::filesystem::weakly_canonical throws if the file
                    disappears during its execution
           Product: gcc
           Version: 14.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at gcc dot gnu.org
  Target Milestone: ---

Created attachment 60365
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60365&action=edit
test case

[forwarded from https://bugs.debian.org/1094270]

The function std::filesystem::weakly_canonical is defined as working
even if the path points to a file that does not exist.

If however the path disappears while weakly_canonical does its thing, we
surprisingly get an exception.

Reproducer:

    $ g++ weakly_canonical.cc -o weakly_canonical
    $ ./weakly_canonical
    Canonicalized path for missing file: "…/tmp/does-not-exist"
    weakly_canonical failed at iteration 36: filesystem error: cannot make
canonical path: No such file or directory [tmp/test]

Reply via email to