Opened 5 years ago
#13135 new Bugs
boost::filesystem::exists silently fails to work on MSVC with newly created symlink
| Reported by: | Antony Polukhin | Owned by: | Beman Dawes |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | filesystem |
| Version: | Boost 1.65.0 | Severity: | Problem |
| Keywords: | exists fs filesystem msvc | Cc: |
Description
The following program:
#include <boost/filesystem/operations.hpp>
#include <cassert>
#include <fstream>
#include <iostream>
int main() {
boost::system::error_code error;
boost::filesystem::create_directories("dir/subdir", error);
assert(!error);
std::ofstream ofs("dir/subdir/file.txt");
ofs << "Boost.Filesystem is fun!";
assert(ofs);
ofs.close();
boost::filesystem::create_symlink("dir/subdir/file.txt", "symlink", error);
if (!error) {
std::cerr << "Symlink created\n";
assert(boost::filesystem::exists("symlink"));
} else {
std::cerr << "Failed to create a symlink\n";
boost::filesystem::remove_all("dir", error);
assert(!error);
boost::filesystem::remove("symlink", error);
assert(!error);
} /*if (!error)*/
} /*main*/
Works well on Linux and Windows+MinGW but fails to work on msvc-14.0:
--- Stderr:
Symlink created
Assertion failed: boost::filesystem::exists("symlink"), file .\main.cpp, line 20
--- Ret code: 3
Failed run can be found here: https://ci.appveyor.com/project/apolukhin/boost-cookbook/branch/second_edition/job/1ycwqk36phd8h8il
P.S.: Code from above worked well a few months ago. Looks like some recent change broke the example.
Note:
See TracTickets
for help on using tickets.
