php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22641 Glob over NFS
Submitted: 2003-03-11 15:52 UTC Modified: 2003-03-11 19:51 UTC
From: sthomas at townnews dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.1 OS: Redhat 7.3
Private report: No CVE-ID: None
 [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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-11 16:49 UTC] sthomas at townnews dot com
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);
}

------------------------------
 [2003-03-11 19:51 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

I've just tried you sample C program on a system using glibc 2.2.5 and can confirm that the problem is indeed glibc related and not the fault of PHP. Please contact the glibc developers about this bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 23:01:29 2024 UTC