diff --git a/ChangeLog b/ChangeLog index fab8d28ac0..1079b47a5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-06-03 Ulrich Drepper + + * sysdeps/generic/glob.c [HAVE_D_TYPE] (glob_in_dir): Also allow + DT_LNK entries if GLOB_ONLYDIR is set [PR libc/5043]. + * posix/globtest.sh: Adjust for this change. + 2003-06-02 Ulrich Drepper * sysdeps/unix/sysv/linux/ifaddrs.c (netlink_open): Call getsockname diff --git a/posix/globtest.sh b/posix/globtest.sh index d5032562ea..69f8e8b38e 100755 --- a/posix/globtest.sh +++ b/posix/globtest.sh @@ -30,6 +30,7 @@ testout=$TMPDIR/globtest-out trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15 +test -d $testdir/noread && chmod 777 $testdir/noread rm -fr $testdir 2>/dev/null mkdir $testdir echo 1 > $testdir/file1 @@ -44,6 +45,7 @@ test -d $testdir/noread || mkdir $testdir/noread chmod a-r $testdir/noread echo 1_1 > $testdir/dir1/file1_1 echo 1_2 > $testdir/dir1/file1_2 +ln -fs dir1 $testdir/link1 # Run some tests. result=0 @@ -61,6 +63,7 @@ cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir2' `file1' `file2' +`link1' `noread' `~file4' EOF @@ -81,6 +84,7 @@ cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir2' `file1' `file2' +`link1' `noread' `~file4' EOF @@ -101,6 +105,7 @@ cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir2/' `file1' `file2' +`link1/' `noread/' `~file4' EOF @@ -124,6 +129,7 @@ cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir2' `file1' `file2' +`link1' `noread' `~file4' EOF @@ -232,6 +238,8 @@ sort > $testout cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir1/file1_1' `dir1/file1_2' +`link1/file1_1' +`link1/file1_2' EOF if test $failed -ne 0; then echo "Subdirs test failed" >> $logfile @@ -258,6 +266,7 @@ ${common_objpfx}posix/globtest "$testdir" "*/*1_1" | sort > $testout cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir1/file1_1' +`link1/file1_1' EOF if test $failed -ne 0; then echo "Wildcard subdir test failed" >> $logfile @@ -272,6 +281,8 @@ sort > $testout cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir1/file1_1' `dir1/file1_2' +`link1/file1_1' +`link1/file1_2' EOF if test $failed -ne 0; then echo "Wildcard2 subdir test failed" >> $logfile @@ -284,6 +295,7 @@ ${common_objpfx}posix/globtest "$testdir" "*/file1_1" | sort > $testout cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir1/file1_1' +`link1/file1_1' EOF if test $failed -ne 0; then echo "Wildcard3 subdir test failed" >> $logfile @@ -322,6 +334,8 @@ sort > $testout cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir1/file1_1' `dir1/file1_2' +`link1/file1_1' +`link1/file1_2' EOF if test $failed -ne 0; then echo "Wildcard6 subdir test failed" >> $logfile @@ -336,6 +350,8 @@ sort > $testout cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir1/file1_1' `dir1/file1_2' +`link1/file1_1' +`link1/file1_2' EOF if test $failed -ne 0; then echo "Brackets test failed" >> $logfile @@ -544,6 +560,8 @@ cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir1/file1_1' `dir1/file1_2' `file1' +`link1/file1_1' +`link1/file1_2' EOF if test $failed -ne 0; then echo "GLOB_APPEND test failed" >> $logfile @@ -560,6 +578,8 @@ cat <<"EOF" | cmp - $testout >> $logfile || failed=1 `dir1/file1_1' `dir1/file1_2' `file1' +`link1/file1_1' +`link1/file1_2' EOF if test $failed -ne 0; then echo "GLOB_APPEND2 test failed" >> $logfile diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c index fa23f8cac1..8ab8e43a51 100644 --- a/sysdeps/generic/glob.c +++ b/sysdeps/generic/glob.c @@ -1388,7 +1388,9 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) /* 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) + && d->d_type != DT_UNKNOWN + && d->d_type != DT_DIR + && d->d_type != DT_LNK) continue; #endif