Package: glibc Version: 2.3.1-16 Severity: normal glob() is busted in glibc because it does not correctly handle the situation where a symlink is part of a path. For example: There exists a symlink: /data/a -> /data1/a /data1/a is a directory which contains: abc def xyz A glob() call using the pattern: /data/*/* will fail. This is because around line 1373 of glob.c there exists the following code: ------- #ifdef HAVE_D_TYPE /* If we shall match only directories use the information provided by the dirent call if possible. */ if ((flags & GLOB_ONLYDIR) && d->d_type != DT_UNKNOWN && d->d_type != DT_DIR) continue; #endif ------- When a path element is a symlink the d_type for it is DT_LINK. DT_LINK should probably be added to the statement above as another valid type. Of course, another check will need to be made if you want to be sure the symlink points to a directory. This check should probably work on any type of file and be outside the #ifdef above so that GLOB_ONLYDIR will work when HAVE_D_TYPE isn't defined (as I read it this isn't the case currently). Stephen
Attachment:
pgpiaQzsLHbHk.pgp
Description: PGP signature