glob: match dangling symlinks
commitfd1daf4e1824bb46c08ba6244b4d41c8cecb3642
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 31 Aug 2017 21:34:25 +0000 (31 14:34 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 31 Aug 2017 22:08:44 +0000 (31 15:08 -0700)
tree0b4f19a24b3413edb1e1e9788f10804458549003
parentc8e57c1ad7dabfd422a14015e1c81889eaf9d028
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.
ChangeLog
doc/posix-functions/glob.texi
lib/glob.c
lib/glob.in.h
m4/glob.m4
modules/glob
modules/glob-tests
tests/test-glob.c