|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-03-11 15:52 UTC] sthomas at townnews dot com
When using glob over NFS, it appears that the flag GLOB_ONLYDIR does not work.
<?PHP
print_r(glob("dir/*", GLOB_ONLYDIR));
print_r(glob("nfs-dir/*", GLOB_ONLYDIR));
?>
The first glob will only return the directories, which is correct. However the second glob will return all files. The only difference between these two directories is that nfs-dir is a directory mounted over NFS.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 17:00:01 2025 UTC |
Not sure this is relevant, but I used this code to test glob itself, and the problem with NFS persists. If that's the case, this is actually a bug in GLIBC. Can someone confirm? When I ran this over an NFS, it didn't mark the non-directory with a /, so it obviously knows the file isn't a directory... why then does it include it in the results? Weird. ------------------------------ #include <glob.h> #include <stdio.h> int main() { glob_t globbuf; int i; globbuf.gl_offs = 15; glob("/nfs-dir/*", GLOB_ONLYDIR | GLOB_MARK, NULL, &globbuf); for(i = 0; i < globbuf.gl_pathc; i++) printf("%s\n",globbuf.gl_pathv[i]); globfree(&globbuf); return(0); } ------------------------------