Re: [Boost-bugs] [Boost C++ Libraries] #6821: recursive_directory_iterator: increment fails with 'access denied'

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6821: recursive_directory_iterator: increment fails with 'access denied'
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-03-25 16:27:14


#6821: recursive_directory_iterator: increment fails with 'access denied'
-----------------------------------------------+----------------------------
  Reporter: Gary Sanders <lex21@…> | Owner: bemandawes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: filesystem
   Version: Boost 1.49.0 | Severity: Problem
Resolution: | Keywords:
-----------------------------------------------+----------------------------

Comment (by Claudio Bley):

 Actually, this is a regression in regard to v2.

 In v2 you could use no_push() in order to skip a directory after an error
 occurred.

 With v3, the directory_iterator at the top of the stack is invalid (ie. an
 end iterator) if an error occurs. So, you cannot dereference it, and you
 cannot use any other method (e.g. no_push) on it, otherwise std::abort
 will be called.

 Simple fix: just don't push an end iterator to m_stack.

 {{{
 --- C:\Users\Claudio\src\boost.svn\boost\filesystem\operations.hpp
 2012-07-24 08:43:28 +0200
 +++ boost\filesystem\operations.hpp 2013-03-25 17:21:39 +0100
 @@ -791,9 +791,11 @@
              m_stack.push(directory_iterator(m_stack.top()->path()));
            else
            {
 - m_stack.push(directory_iterator(m_stack.top()->path(), *ec));
 + directory_iterator next =
 directory_iterator(m_stack.top()->path(), *ec);
              if (*ec)
                return;
 + else
 + m_stack.push(next);
            }
            if (m_stack.top() != directory_iterator())
            {
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6821#comment:5>
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:12 UTC