Your message dated Mon, 3 Feb 2025 21:26:04 +0100
with message-id <2cdaffcc-68bb-46a0-a687-b315fba97...@debian.org>
and subject line closed as invalid upstream
has caused the Debian Bug report #1094270,
regarding std::filesystem::weakly_canonical throws if the file disappears 
during its execution
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
1094270: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1094270
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: libstdc++-14-dev
Version: 14.2.0-12
Severity: normal

Hello,

thank you for maintaining libstdc++.

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.

I'm attaching a 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]

Enrico

-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.6-amd64 (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_IE:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libstdc++-14-dev depends on:
ii  gcc-14-base    14.2.0-12
ii  libc6-dev      2.40-5
ii  libgcc-14-dev  14.2.0-12
ii  libstdc++6     14.2.0-12

libstdc++-14-dev recommends no packages.

Versions of packages libstdc++-14-dev suggests:
pn  libstdc++-14-doc  <none>

-- no debconf information
#include <filesystem>
#include <thread>
#include <iostream>

std::filesystem::path workdir("tmp");
auto oddpath = workdir / "test";
bool done = false;

void glitch()
{
    while (! done)
    {
        std::filesystem::remove(oddpath);
        std::filesystem::create_directory(oddpath);
    }
}

void canonical()
{
    unsigned iteration = 0;
    try {
        while (true)
        {
            ++iteration;
            (void)std::filesystem::weakly_canonical(oddpath);
        }
    } catch (std::exception& e) {
        done = true;
        std::cerr << "weakly_canonical failed at iteration " << iteration << ": 
" << e.what() << std::endl;
    }
}


int main(int argc, const char* argv[])
{
    std::filesystem::create_directory(workdir);
    auto missing = std::filesystem::weakly_canonical(workdir / 
"does-not-exist");
    std::cerr << "Canonicalized path for missing file: " << missing << 
std::endl;

    std::thread glitcher(glitch);

    canonical();

    glitcher.join();

    std::filesystem::remove_all(workdir);

    return 0;
}

--- End Message ---
--- Begin Message ---
closed as invalid upstream

--- End Message ---

Reply via email to