You have been subscribed to a public bug: Ubuntu version: 2.6.32-24-generic #43-Ubuntu SMP Thu Sep 16 14:58:24 UTC 2010 x86_64 GNU/Linux
g++ version: (Ubuntu 4.4.3-4ubuntu5) 4.4.3 How to reproduce the problem: - create a new folder, copy attached *.cpp file, compile using g++ - create 2 sub-folders, create a file (e.g. x.cpp) in each sub-folder - copy compiled a.out to one of the sub-folders, change dir to this sub-folder - execute: ./a.out .. .cpp -> Result (FAILURE): the second sub-folder is NOT scanned (folder found by readdir(), but dirent.d_type = 0 when additional printf debug applied, see laso detailed log below) - execute shell cmd: ls -alR .. - execute: ./a.out .. .cpp -> Result (OK): the second folder is scanned The problem may be related to: https://lists.ubuntu.com/archives/foundations-bugs/2011-May/000176.html I don't have access to the latest 64-bit ubuntu to chack if the problem was fixed. Problem not observed if another method is used to check id readdir() result is a directory (sys/stat.h, lstat() function, S_ISDIR(buf.st_mode) always returns the correct result) ------------ log --------------- epawszy@stebasxu0434:~/tmp/traversing_folders_linux/DirA$ ./a.out Current folder: /user/epawszy/tmp/traversing_folders_linux/DirA Working folder: /user/epawszy/tmp/traversing_folders_linux DBG: pItem->d_type = 0 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/a.out DBG: pItem->d_type = 0 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/traversing_folders_stack_linux.cpp DBG: pItem->d_type = 4 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/DirA DBG: pItem->d_type = 0 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/__orig_traversing_folders_stack_linux.cpp DBG: pItem->d_type = 0 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/__log.txt DBG: pItem->d_type = 0 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/DirB DBG: pItem->d_type = 8 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/DirA/a.out DBG: pItem->d_type = 0 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/DirA/a.cpp /user/epawszy/tmp/traversing_folders_linux/traversing_folders_stack_linux.cpp /user/epawszy/tmp/traversing_folders_linux/__orig_traversing_folders_stack_linux.cpp /user/epawszy/tmp/traversing_folders_linux/DirA/a.cpp Found 3 files All words count 868 Unique words count 260 Top 20 words: 70 << 35 } 35 { 33 = 22 endl; 22 cout 20 #include 16 " 14 ) 12 if 12 ( 10 int 10 string 10 != 8 const 8 for 8 folder 8 ); 7 pos 7 == epawszy@stebasxu0434:~/tmp/traversing_folders_linux/DirA$ ls -al total 112 drwxr-xr-x 2 epawszy eml-users 4096 2011-09-06 11:28 . drwxr-xr-x 4 epawszy eml-users 4096 2011-09-06 11:27 .. -rw-r--r-- 1 epawszy eml-users 38 2011-09-06 11:19 a.cpp -rwxr-xr-x 1 epawszy eml-users 99840 2011-09-06 11:28 a.out epawszy@stebasxu0434:~/tmp/traversing_folders_linux/DirA$ ls -al .. total 144 drwxr-xr-x 4 epawszy eml-users 4096 2011-09-06 11:27 . drwxr-xr-x 33 epawszy eml-users 4096 2011-09-05 13:22 .. -rwxr-xr-x 1 epawszy eml-users 99840 2011-09-06 11:27 a.out drwxr-xr-x 2 epawszy eml-users 4096 2011-09-06 11:28 DirA drwxr-xr-x 2 epawszy eml-users 4096 2011-09-06 11:20 DirB -rw-r--r-- 1 epawszy eml-users 13756 2011-09-06 11:09 __log.txt -rw-r--r-- 1 epawszy eml-users 3683 2011-09-06 10:32 __orig_traversing_folders_stack_linux.cpp -rwxr--r-- 1 epawszy eml-users 3754 2011-09-06 11:27 traversing_folders_stack_linux.cpp epawszy@stebasxu0434:~/tmp/traversing_folders_linux/DirA$ cd .. epawszy@stebasxu0434:~/tmp/traversing_folders_linux$ ls -al total 144 drwxr-xr-x 4 epawszy eml-users 4096 2011-09-06 11:27 . drwxr-xr-x 33 epawszy eml-users 4096 2011-09-05 13:22 .. -rwxr-xr-x 1 epawszy eml-users 99840 2011-09-06 11:27 a.out drwxr-xr-x 2 epawszy eml-users 4096 2011-09-06 11:28 DirA drwxr-xr-x 2 epawszy eml-users 4096 2011-09-06 11:20 DirB -rw-r--r-- 1 epawszy eml-users 13756 2011-09-06 11:09 __log.txt -rw-r--r-- 1 epawszy eml-users 3683 2011-09-06 10:32 __orig_traversing_folders_stack_linux.cpp -rwxr--r-- 1 epawszy eml-users 3754 2011-09-06 11:27 traversing_folders_stack_linux.cpp epawszy@stebasxu0434:~/tmp/traversing_folders_linux$ ls -al Dir* DirA: total 112 drwxr-xr-x 2 epawszy eml-users 4096 2011-09-06 11:28 . drwxr-xr-x 4 epawszy eml-users 4096 2011-09-06 11:27 .. -rw-r--r-- 1 epawszy eml-users 38 2011-09-06 11:19 a.cpp -rwxr-xr-x 1 epawszy eml-users 99840 2011-09-06 11:28 a.out DirB: total 8 drwxr-xr-x 2 epawszy eml-users 4096 2011-09-06 11:20 . drwxr-xr-x 4 epawszy eml-users 4096 2011-09-06 11:27 .. -rw-r--r-- 1 epawszy eml-users 41 2011-09-06 11:20 b.cpp epawszy@stebasxu0434:~/tmp/traversing_folders_linux$ ls -alR .: total 144 drwxr-xr-x 4 epawszy eml-users 4096 2011-09-06 11:27 . drwxr-xr-x 33 epawszy eml-users 4096 2011-09-05 13:22 .. -rwxr-xr-x 1 epawszy eml-users 99840 2011-09-06 11:27 a.out drwxr-xr-x 2 epawszy eml-users 4096 2011-09-06 11:28 DirA drwxr-xr-x 2 epawszy eml-users 4096 2011-09-06 11:20 DirB -rw-r--r-- 1 epawszy eml-users 13756 2011-09-06 11:09 __log.txt -rw-r--r-- 1 epawszy eml-users 3683 2011-09-06 10:32 __orig_traversing_folders_stack_linux.cpp -rwxr--r-- 1 epawszy eml-users 3754 2011-09-06 11:27 traversing_folders_stack_linux.cpp ./DirA: total 112 drwxr-xr-x 2 epawszy eml-users 4096 2011-09-06 11:28 . drwxr-xr-x 4 epawszy eml-users 4096 2011-09-06 11:27 .. -rw-r--r-- 1 epawszy eml-users 38 2011-09-06 11:19 a.cpp -rwxr-xr-x 1 epawszy eml-users 99840 2011-09-06 11:28 a.out ./DirB: total 8 drwxr-xr-x 2 epawszy eml-users 4096 2011-09-06 11:20 . drwxr-xr-x 4 epawszy eml-users 4096 2011-09-06 11:27 .. -rw-r--r-- 1 epawszy eml-users 41 2011-09-06 11:20 b.cpp epawszy@stebasxu0434:~/tmp/traversing_folders_linux$ cd - /user/epawszy/tmp/traversing_folders_linux/DirA epawszy@stebasxu0434:~/tmp/traversing_folders_linux/DirA$ ./a.out Current folder: /user/epawszy/tmp/traversing_folders_linux/DirA Working folder: /user/epawszy/tmp/traversing_folders_linux DBG: pItem->d_type = 8 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/a.out DBG: pItem->d_type = 8 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/traversing_folders_stack_linux.cpp DBG: pItem->d_type = 4 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/DirA DBG: pItem->d_type = 8 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/__orig_traversing_folders_stack_linux.cpp DBG: pItem->d_type = 8 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/__log.txt DBG: pItem->d_type = 4 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/DirB DBG: pItem->d_type = 8 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/DirB/b.cpp DBG: pItem->d_type = 8 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/DirA/a.out DBG: pItem->d_type = 8 DBG: dirEntryName = /user/epawszy/tmp/traversing_folders_linux/DirA/a.cpp /user/epawszy/tmp/traversing_folders_linux/traversing_folders_stack_linux.cpp /user/epawszy/tmp/traversing_folders_linux/__orig_traversing_folders_stack_linux.cpp /user/epawszy/tmp/traversing_folders_linux/DirB/b.cpp /user/epawszy/tmp/traversing_folders_linux/DirA/a.cpp Found 4 files All words count 879 Unique words count 263 Top 20 words: 70 << 36 } 36 { 34 = 22 endl; 22 cout 20 #include 16 " 14 ) 12 ( 12 int 12 if 10 string 10 != 8 folder 8 const 8 for 8 ); 7 pos 7 == ** Affects: gcc-4.4 (Ubuntu) Importance: Undecided Status: New ** Tags: 64-bit dirent.h readdir ubuntu -- Ubuntu 64-bit g++ dirent.d_type incorrect value https://bugs.launchpad.net/bugs/842998 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
