Subject: [Boost-bugs] [Boost C++ Libraries] #6821: recursive_directory_iterator: increment fails with 'access denied'
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-04-22 18:53:20
#6821: recursive_directory_iterator: increment fails with 'access denied'
----------------------------------------------+-----------------------------
Reporter: Gary Sanders <lex21@â¦> | Owner: bemandawes
Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
Version: Boost 1.49.0 | Severity: Problem
Keywords: |
----------------------------------------------+-----------------------------
This issue is found on Windows 7 x64, Win32 binary built with Visual
Studio 2010. See attachment for sample program.
Recursive iteration fails when iterating a directory that contains a child
directory for which the user does not have permission to access.
The attached program illustrates this issue, assuming that the user has at
least one directory that the current users does not have permission to
access:
{{{
boost::filesystem::directory_iterator::construct: Access is denied:
"c:\$Recycle.Bin\S-1-5-20"
}}}
The exception is caused by FindFirstFileW() returning ERROR_ACCESS_DENIED.
This function is located in dir_itr_first(),
filesystem/v3/src/operations.cpp, line 2000.
Intuitively this iteration should work and any directories for which the
user does not have permission to access should be ignored. Though, perhaps
there are at least two use cases for this behaviour when encountering a
directory for which the user does not have permission to access:
* Iteration is not expected to fail with an 'access denied' error, so if
it encounters this situation throw an error. (The current behaviour.)
* It is unknown if the directory being recursively iterated contains one
or more directories for which the user does not have access. Therefore,
these directories should be ignored and processing allowed to continue.
One solution might be to allow a flag to be passed in the constructor that
would define which of the two behaviours to invoke.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6821> 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:09 UTC