Hash :
fd1daf4e
Author :
Date :
2017-08-31T14:34:25
glob: match dangling symlinks This fixes a bug I inadvertently introduced to Gnulib when I merged glibc glob back into gnulib on 2007-10-16. This fix is inspired by a patch proposed for glibc by Adhemerval Zanella in: https://sourceware.org/ml/libc-alpha/2017-08/msg00446.html * doc/posix-functions/glob.texi: Update list of affected platforms. * lib/glob.c (__lstat64): New macro. (is_dir): New function. (glob, glob_in_dir): Match symlinks even if they are dangling. (link_stat, link_exists_p): Remove. All uses removed. * lib/glob.in.h (__attribute_noinline__): Remove; no longer used. * m4/glob.m4 (gl_PREREQ_GLOB): Do not check for fstatat. * modules/glob (Depends-on): Remove dirfd. * modules/glob-tests (Depends-on): Add symlink. * tests/test-glob.c: Include errno.h, unistd.h. (BASE): New macro. (main): Test dangling symlinks, if symlinks are supported.
@node glob
@section @code{glob}
@findex glob
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/glob.html}
Gnulib module: glob
Portability problems fixed by Gnulib:
@itemize
@item
This function is missing on some platforms:
IRIX 5.3, mingw, MSVC 14, BeOS.
@item
This function does not list symbolic links to nonexistent files among the results,
on some platforms:
glibc 2.26, AIX 7.2, HP-UX 11, Solaris 11 2011-11.
@item
On platforms where @code{off_t} is a 32-bit type, this function may not
work correctly on huge directories larger than 2 GB.
(Cf. @code{AC_SYS_LARGEFILE}.)
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
Some platforms may store additional flags in the @code{gl_flags} field.
@end itemize