[PHP-BUG] Bug #60666 [NEW]: scandir doesn''t return entries on GlusterFS (redHat's) file system

2012-01-05 Thread hunter at yessoftware dot com
From: 
Operating system: CentOS 5.7
PHP version:  5.3.8
Package:  Directory function related
Bug Type: Bug
Bug description:scandir doesn''t return entries on GlusterFS (redHat's) file 
system

Description:

When I'm trying to scandir or opendir/readdir on GlusterFS Distributed
volumes (mounted to some folder) I got something but not I'm expecting to
obtainan: empty array even without . and .. entries, only . entry, 2-3
entries instead of >100 and so on.

Other ways (bash ls or perl opendir) works correctly.

for example:
distributed GlusterFS volume mounted to /sites/blog folder.
scandir("/sites/blog");

array(0) {
}
distributed GlusterFS volume mounted to /sites/other folder:
scandir("/sites/other");
array(1) {
  [0]=>
  string(1) "."
}
scandir("/sites/other/old");
array(3) {
  [0]=>
  string(1) "."
  [1]=>
  string(11) "1.2.0.2540"
  [2]=>
  string(11) "1.5.0.2559"
}




Test script:
---



-- 
Edit bug report at https://bugs.php.net/bug.php?id=60666&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60666&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60666&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=60666&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60666&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60666&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60666&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=60666&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=60666&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=60666&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=60666&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=60666&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=60666&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=60666&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60666&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=60666&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=60666&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=60666&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=60666&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=60666&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=60666&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=60666&r=mysqlcfg



Bug #60666 [Opn]: scandir doesn''t return entries on GlusterFS (redHat's) file system

2012-01-07 Thread hunter at yessoftware dot com
Edit report at https://bugs.php.net/bug.php?id=60666&edit=1

 ID: 60666
 User updated by:hunter at yessoftware dot com
 Reported by:hunter at yessoftware dot com
 Summary:scandir doesn''t return entries on GlusterFS
 (redHat's) file system
 Status: Open
 Type:   Bug
 Package:Directory function related
 Operating System:   CentOS 5.7
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

PHP strace:
10458 open("/sites/cache", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
10458 fcntl64(3, F_SETFD, FD_CLOEXEC)   = 0
10458 getdents(3, 0x9d0640c, 32768) = -1 EINVAL (Invalid argument)
10458 close(3)  = 0
10458 write(1, "0\r\n", 3)  = 3
10458 open("/nonglustered/dir", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
10458 fcntl64(3, F_SETFD, FD_CLOEXEC)   = 0
10458 getdents(3, 0x9d0640c, 32768) = 120
10458 getdents(3, 0x9d0640c, 32768) = 0
10458 close(3)  = 0
10458 write(1, "3\r\n", 3)  = 3
10458 close(0)  = 0

Perl strace
open("/sites/other", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
brk(0x8608000)  = 0x8608000
getdents64(3, /* 24 entries */, 32768)  = 1352
write(1, "12548855754ef9fb85723261.9149936"..., 38) = 38

So goal is to use getdents64 instead of getdents.

The original Linux getdents() system call did not handle large file systems and 
large file offsets. Consequently, Linux 2.4 added getdents64(), with wider 
types for the d_ino and d_off fields employed in the linux_dirent structure.


Previous Comments:
--------------------
[2012-01-05 22:13:27] hunter at yessoftware dot com

Description:

When I'm trying to scandir or opendir/readdir on GlusterFS Distributed volumes 
(mounted to some folder) I got something but not I'm expecting to obtainan: 
empty array even without . and .. entries, only . entry, 2-3 entries instead of 
>100 and so on.

Other ways (bash ls or perl opendir) works correctly.

for example:
distributed GlusterFS volume mounted to /sites/blog folder.
scandir("/sites/blog");

array(0) {
}
distributed GlusterFS volume mounted to /sites/other folder:
scandir("/sites/other");
array(1) {
  [0]=>
  string(1) "."
}
scandir("/sites/other/old");
array(3) {
  [0]=>
  string(1) "."
  [1]=>
  string(11) "1.2.0.2540"
  [2]=>
  string(11) "1.5.0.2559"
}




Test script:
---








-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60666&edit=1


Bug #60666 [Opn]: scandir doesn''t return entries on GlusterFS (redHat's) file system

2012-01-10 Thread hunter at yessoftware dot com
Edit report at https://bugs.php.net/bug.php?id=60666&edit=1

 ID: 60666
 User updated by:hunter at yessoftware dot com
 Reported by:hunter at yessoftware dot com
 Summary:scandir doesn''t return entries on GlusterFS
 (redHat's) file system
 Status: Open
 Type:   Bug
 Package:Directory function related
 Operating System:   CentOS 5.7
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

I solved it by rebuilding php with 
export CPPFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
./configure


Previous Comments:
----
[2012-01-07 12:36:17] hunter at yessoftware dot com

PHP strace:
10458 open("/sites/cache", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
10458 fcntl64(3, F_SETFD, FD_CLOEXEC)   = 0
10458 getdents(3, 0x9d0640c, 32768) = -1 EINVAL (Invalid argument)
10458 close(3)  = 0
10458 write(1, "0\r\n", 3)  = 3
10458 open("/nonglustered/dir", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
10458 fcntl64(3, F_SETFD, FD_CLOEXEC)   = 0
10458 getdents(3, 0x9d0640c, 32768) = 120
10458 getdents(3, 0x9d0640c, 32768) = 0
10458 close(3)  = 0
10458 write(1, "3\r\n", 3)  = 3
10458 close(0)  = 0

Perl strace
open("/sites/other", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
brk(0x8608000)  = 0x8608000
getdents64(3, /* 24 entries */, 32768)  = 1352
write(1, "12548855754ef9fb85723261.9149936"..., 38) = 38

So goal is to use getdents64 instead of getdents.

The original Linux getdents() system call did not handle large file systems and 
large file offsets. Consequently, Linux 2.4 added getdents64(), with wider 
types for the d_ino and d_off fields employed in the linux_dirent structure.

--------------------
[2012-01-05 22:13:27] hunter at yessoftware dot com

Description:

When I'm trying to scandir or opendir/readdir on GlusterFS Distributed volumes 
(mounted to some folder) I got something but not I'm expecting to obtainan: 
empty array even without . and .. entries, only . entry, 2-3 entries instead of 
>100 and so on.

Other ways (bash ls or perl opendir) works correctly.

for example:
distributed GlusterFS volume mounted to /sites/blog folder.
scandir("/sites/blog");

array(0) {
}
distributed GlusterFS volume mounted to /sites/other folder:
scandir("/sites/other");
array(1) {
  [0]=>
  string(1) "."
}
scandir("/sites/other/old");
array(3) {
  [0]=>
  string(1) "."
  [1]=>
  string(11) "1.2.0.2540"
  [2]=>
  string(11) "1.5.0.2559"
}




Test script:
---








-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60666&edit=1