Ubuntu 64-bit g++ dirent.d_type incorrect value
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-4.4 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
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:/
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(
------------ log ---------------
epawszy@
Current folder:
/user/epawszy/
Working folder:
/user/epawszy/
DBG: pItem->d_type = 0
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 0
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 4
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 0
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 0
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 0
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 8
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 0
DBG: dirEntryName = /user/epawszy/
/user/epawszy/
/user/epawszy/
/user/epawszy/
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@
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@
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_
-rwxr--r-- 1 epawszy eml-users 3754 2011-09-06 11:27 traversing_
epawszy@
epawszy@
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_
-rwxr--r-- 1 epawszy eml-users 3754 2011-09-06 11:27 traversing_
epawszy@
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@
.:
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_
-rwxr--r-- 1 epawszy eml-users 3754 2011-09-06 11:27 traversing_
./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@
/user/epawszy/
epawszy@
Current folder:
/user/epawszy/
Working folder:
/user/epawszy/
DBG: pItem->d_type = 8
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 8
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 4
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 8
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 8
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 4
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 8
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 8
DBG: dirEntryName = /user/epawszy/
DBG: pItem->d_type = 8
DBG: dirEntryName = /user/epawszy/
/user/epawszy/
/user/epawszy/
/user/epawszy/
/user/epawszy/
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 ==
Reassigning to ubuntu/gcc-4.4