[Boost-bugs] [Boost C++ Libraries] #13135: boost::filesystem::exists silently fails to work on MSVC with newly created symlink

Subject: [Boost-bugs] [Boost C++ Libraries] #13135: boost::filesystem::exists silently fails to work on MSVC with newly created symlink
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-07-25 09:09:54


#13135: boost::filesystem::exists silently fails to work on MSVC with newly created
symlink
---------------------------------------+-------------------------
 Reporter: Antony Polukhin | Owner: Beman Dawes
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
  Version: Boost 1.65.0 | Severity: Problem
 Keywords: exists fs filesystem msvc |
---------------------------------------+-------------------------
 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.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13135>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-07-25 09:12:45 UTC