[Boost-bugs] [Boost C++ Libraries] #8946: filesystem::directory_iterator returns incorrect listing

Subject: [Boost-bugs] [Boost C++ Libraries] #8946: filesystem::directory_iterator returns incorrect listing
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-07-31 09:07:41


#8946: filesystem::directory_iterator returns incorrect listing
--------------------------------+------------------------
 Reporter: l.alebarde@… | Owner: bemandawes
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
  Version: Boost 1.53.0 | Severity: Problem
 Keywords: directory_iterator |
--------------------------------+------------------------
 Both '''directory_iterator''' and '''recursive_directory_iterator''' do
 not work correctly under linux with g++-4.7.3 : one item, assumed to be
 the last one, is not listed.

 Simple code to reproduce the problem :
 {{{
 #include <iostream>
 #include <stdio.h>
 #include <boost/filesystem.hpp>

 using namespace std;
 namespace bfs = boost::filesystem;

 int main () {
         system("mkdir mydir");
         system("touch mydir/file1");
         system("touch mydir/file2");
         bfs::directory_iterator bfs_dir_i_end;
         bfs::directory_iterator bfs_dir_i("mydir/.");
         while (++bfs_dir_i != bfs_dir_i_end) {
                 bfs::file_type type = (*bfs_dir_i).status().type();
                 bfs::path source = (*bfs_dir_i).path();
                 cout << source << " " << type << endl;
         }
 }
 }}}

 Build with :
 {{{
 g++-4.7.3 -I/usr/include/crypto++ -O0 -g3 -Wall -c -fmessage-length=0
 -std=c++11 show_bug_directory_iterator.cpp
 g++-4.7.3 -lboost_filesystem -o show_bug_directory_iterator
 show_bug_directory_iterator.o
 }}}

 Code result :
 {{{
 $ ./show_bug_directory_iterator
 "mydir/./file1" 2
 }}}

 Should be :
 {{{
 $ ./show_bug_directory_iterator
 "mydir/./file1" 2
 "mydir/./file2" 2
 }}}

 Shell result :
 {{{
 $ ls -lR .
 .:
 total 1620
 drwxr-xr-x 2 alain alain 4096 31 juil. 10:48 mydir
 -rwxr-xr-x 1 alain alain 639766 31 juil. 10:48
 show_bug_directory_iterator
 -rw-r--r-- 1 alain alain 497 31 juil. 10:44
 show_bug_directory_iterator.cpp
 -rw-r--r-- 1 alain alain 1006376 31 juil. 10:48
 show_bug_directory_iterator.o

 ./mydir:
 total 0
 -rw-r--r-- 1 alain alain 0 31 juil. 10:48 file1
 -rw-r--r-- 1 alain alain 0 31 juil. 10:48 file2
 }}}

 Notes :
   1) Not tested under other gcc versions.

   2) Tested with same results on Boost 1.52.0 and 1.53.0

   3) suspected regression, cf
 [https://svn.boost.org/trac/boost/ticket/257]

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8946>
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:13 UTC