[Boost-bugs] [Boost C++ Libraries] #13369: [Windows] Cannot handle symbolic links

Subject: [Boost-bugs] [Boost C++ Libraries] #13369: [Windows] Cannot handle symbolic links
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-12-30 07:26:05


#13369: [Windows] Cannot handle symbolic links
-------------------------------------------------+-------------------------
 Reporter: 0x0c0ff33.1523@… | Owner: Beman Dawes
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
  Version: Boost 1.66.0 | Severity: Problem
 Keywords: |
  bug,filesystem,error,symlink,shortcut |
-------------------------------------------------+-------------------------
 I wanted to port my application from Linux to Windows, but shortcut
 handling is not working.

 Symlink creation, resolution and detection is not possible on my Windows
 10 (Version 1709).

 Tested with Boost 1.66.0 and 1.64.0.

 Compiled the Boost Libraries with MSVC (Version 19.10.25019 for x86 and
 x64).

 Getting the exception "boost::filesystem::create_symlink: A required
 privilege is not held by the client"

 Example:

 {{{
 #include <boost/filesystem.hpp>
 namespace fs = boost::filesystem;

 int main(){
         try{
                 fs::create_symlink("/path/to_target", "/path/to/link");
         }

         catch(const std::exception& err){
                 std::cerr << err.what() << '\n';
         }
 }
 }}}

 Also boost::fileystem::canonical() is not working for me. Tested with
 extensions ".lnk" and ".url" and without extension, gives me the path to
 the symbolic link itself (with .lnk), otherwise path not found.

 {{{
 int main(){
         fs::path path = "/path/to/shortcut";

         for(const auto& ext : {"", ".lnk", ".url"}){
                 try{
                         std::cout << fs::canonical(path.string() + ext) <<
 '\n';
                 }

                 catch(const std::exception& err){
                         std::cerr << err.what() << '\n';
                 }
         }
 }}}

 Also symlinks cannot be detected by fs::is_symlink() on my Windows system.

 {{{
 int main(){
         fs::path path = "/path/to/shortcut";

         for(const auto& ext : {"", ".lnk", ".url"}){
                 auto s = fs::symlink_status(path.string() + ext);
                 std::cout << (s.type() == fs::file_type::symlink_file) <<
 ',' << fs::is_symlink(s) << '\n';
         }
 }
 }}}

 Returns always false.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13369>
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-12-30 07:31:07 UTC