Skip to content

Trac #7404 "filesystem::canonical fails on UNC paths on Windows" still an issue in 1.68 #87

@Bigpet

Description

@Bigpet

Original text:

The filesystem library function canonical(p, base) fails for all UNC paths on Windows because it gets an "invalid path" error when it calls symlink_status at line 816 of operations.cpp. Example: For the path "\server\share\file", the first time execution reaches line 816 of operations.cpp, it calls is_symlink(detail::symlink_status("server", ec)) and ec is set to the Windows "invalid path" system error code.

This is still an issue. Minimal program to reproduce:

#include <boost/filesystem.hpp>
#include <cstdio>

namespace fs = boost::filesystem;

int main(int argc, const char** argv)
{
	fs::path p(R"(\\localhost\c$)");
	boost::system::error_code ec;
	auto p2 = fs::canonical(p,ec);
	printf("%d", ec.value());
}

Only happens on Windows platforms, specifically because of the call to boost::filesystem::detail::symlink_status during filesystem::canonical

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions