diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2017-09-04 16:22:28 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2017-09-08 15:51:25 +0200 |
commit | 5554304f0dddf75dc27cc6250fc53355161fd16a (patch) | |
tree | 4a11cc89f3a5e1d6920b84aadb619010ef3f759e /posix/Makefile | |
parent | 686f2ea18374a541d203cfcc0e1dfba1666f49c2 (diff) | |
download | glibc-5554304f0dddf75dc27cc6250fc53355161fd16a.zip glibc-5554304f0dddf75dc27cc6250fc53355161fd16a.tar.gz glibc-5554304f0dddf75dc27cc6250fc53355161fd16a.tar.bz2 |
posix: Allow glob to match dangling symlinks [BZ #866]
This patch makes glob match dangling symlinks. Compared to other glob
implementation (*BSD, bash, musl, and other shells as well), GLIBC seems
the be the only one that does not match dangling symlinks. As for
comment #5 in BZ #866, POSIX does not have any strict specification for
dangling symlinks match and it is reasonable that trying to glob everything
in a path should return all types of files (such as for a 'rm *'). Also,
comment #7 shows even more example where GLIBC current behavior is
unexepected.
I avoided adding another GNU specific flag to set this behavior and
instead make it the default. Although this change the semanthic from
previous implementation, I think adding another compat symbol to be
really unecessary as from aforementioned reasons (current behavior not
defined in any standard, general idea of different implementation is
to list dangling symbols).
This also sync glob with gnulib commit fd1daf4 (glob: match dangling
symlinks).
Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py
for all major architectures.
[BZ #866]
[BZ #1062]
* posix/Makefile (tests): Remove bug-glob1 and tst-glob_symlinks.
* posix/bug-glob1.c: Remove file.
* posix/tst-glob_symlinks.c: New file.
* posix/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.
Diffstat (limited to 'posix/Makefile')
-rw-r--r-- | posix/Makefile | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/posix/Makefile b/posix/Makefile index 0ff8f5c..7188cba 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -79,7 +79,7 @@ tests := test-errno tstgetopt testfnm runtests runptests \ tst-nice tst-nanosleep tst-regex2 \ transbug tst-rxspencer tst-pcre tst-boost \ bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \ - tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \ + tst-getaddrinfo2 bug-glob2 bug-glob3 tst-sysconf \ tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \ tst-execv1 tst-execv2 tst-execl1 tst-execl2 \ tst-execve1 tst-execve2 tst-execle1 tst-execle2 \ @@ -93,7 +93,7 @@ tests := test-errno tstgetopt testfnm runtests runptests \ tst-fnmatch3 bug-regex36 tst-getaddrinfo5 \ tst-posix_spawn-fd tst-posix_spawn-setsid \ tst-posix_fadvise tst-posix_fadvise64 \ - tst-sysconf-empty-chroot + tst-sysconf-empty-chroot tst-glob_symlinks tests-internal := bug-regex5 bug-regex20 bug-regex33 \ tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 xtests := bug-ga2 |