Subject: [Boost-bugs] [Boost C++ Libraries] #12108: boost::filesystem::canonical() enters infinite loop when current path is a directory symlink on windows
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-04-01 08:02:02
#12108: boost::filesystem::canonical() enters infinite loop when current path is a
directory symlink on windows
-----------------------------------------+------------------------
Reporter: Tony Abbott <tony.abbott@â¦> | Owner: bemandawes
Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
Version: Boost 1.60.0 | Severity: Problem
Keywords: |
-----------------------------------------+------------------------
On Windows platforms, when the current path is a directory symlink,
boost::filesystem::canonical() enters an infinite loop.
Verified using attached program on Windows 8.1 and Windows Server 2012.
The problem occurs because when the current path is a directory symlink
then boost::filesystem::is_symlink(path("c:")) returns true.
Assuming the following paths:
myDir = c:\temp\symlink-example\dir
mySym = c:\temp\symlink-example\sym -> myDir
myFile = c:\temp\symlink-example\dir\hello.txt
When current path is set to mySym and canonical(myFile) is called:
* The path components of myFile are iterated over (operations.cpp:827)
* "c:" is the first component. It is considered a symlink and expanded
(operations.cpp:844)
* The path then becomes c:\temp\symlink-example\dir\temp\symlink-
example\dir\hello.txt
* scan is set true and the loop repeats. "c:" is again expanded. The loop
repeats infinitely as the path grows longer and longer
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12108> 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-02-16 18:50:19 UTC