Update.
* sysdeps/generic/glob.c (glob): Handle GLOB_BRACE and escaping correctly. * posix/globtest.sh: Add tests for GLOB_BRACE and escaping.
This commit is contained in:
parent
5ae19a5023
commit
98d2ca3d87
@ -1,5 +1,9 @@
|
|||||||
2003-10-26 Ulrich Drepper <drepper@redhat.com>
|
2003-10-26 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/generic/glob.c (glob): Handle GLOB_BRACE and escaping
|
||||||
|
correctly.
|
||||||
|
* posix/globtest.sh: Add tests for GLOB_BRACE and escaping.
|
||||||
|
|
||||||
* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr_r): Default
|
* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr_r): Default
|
||||||
reverse lookup format for IPv6 addresses is using bitfields and
|
reverse lookup format for IPv6 addresses is using bitfields and
|
||||||
.ip6.arpa suffix.
|
.ip6.arpa suffix.
|
||||||
|
@ -5,6 +5,9 @@ elf_objpfx=$1; shift
|
|||||||
rtld_installed_name=$1; shift
|
rtld_installed_name=$1; shift
|
||||||
logfile=$common_objpfx/posix/globtest.out
|
logfile=$common_objpfx/posix/globtest.out
|
||||||
|
|
||||||
|
#CMP=cmp
|
||||||
|
CMP="diff -u"
|
||||||
|
|
||||||
# We have to make the paths `common_objpfx' absolute.
|
# We have to make the paths `common_objpfx' absolute.
|
||||||
case "$common_objpfx" in
|
case "$common_objpfx" in
|
||||||
.*)
|
.*)
|
||||||
@ -39,6 +42,12 @@ echo 3 > $testdir/-file3
|
|||||||
echo 4 > $testdir/~file4
|
echo 4 > $testdir/~file4
|
||||||
echo 5 > $testdir/.file5
|
echo 5 > $testdir/.file5
|
||||||
echo 6 > $testdir/'*file6'
|
echo 6 > $testdir/'*file6'
|
||||||
|
echo 7 > $testdir/'{file7,}'
|
||||||
|
echo 8 > $testdir/'\{file8\}'
|
||||||
|
echo 9 > $testdir/'\{file9\,file9b\}'
|
||||||
|
echo 9 > $testdir/'\file9b\' #'
|
||||||
|
echo a > $testdir/'filea,'
|
||||||
|
echo a > $testdir/'fileb}c'
|
||||||
mkdir $testdir/dir1
|
mkdir $testdir/dir1
|
||||||
mkdir $testdir/dir2
|
mkdir $testdir/dir2
|
||||||
test -d $testdir/noread || mkdir $testdir/noread
|
test -d $testdir/noread || mkdir $testdir/noread
|
||||||
@ -56,15 +65,21 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "*" |
|
${common_objpfx}posix/globtest "$testdir" "*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`*file6'
|
`*file6'
|
||||||
`-file3'
|
`-file3'
|
||||||
|
`\file9b\'
|
||||||
|
`\{file8\}'
|
||||||
|
`\{file9\,file9b\}'
|
||||||
`dir1'
|
`dir1'
|
||||||
`dir2'
|
`dir2'
|
||||||
`file1'
|
`file1'
|
||||||
`file2'
|
`file2'
|
||||||
|
`filea,'
|
||||||
|
`fileb}c'
|
||||||
`link1'
|
`link1'
|
||||||
`noread'
|
`noread'
|
||||||
|
`{file7,}'
|
||||||
`~file4'
|
`~file4'
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -77,15 +92,21 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -s "$testdir" "*" |
|
${common_objpfx}posix/globtest -s "$testdir" "*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`*file6'
|
`*file6'
|
||||||
`-file3'
|
`-file3'
|
||||||
|
`\file9b\'
|
||||||
|
`\{file8\}'
|
||||||
|
`\{file9\,file9b\}'
|
||||||
`dir1'
|
`dir1'
|
||||||
`dir2'
|
`dir2'
|
||||||
`file1'
|
`file1'
|
||||||
`file2'
|
`file2'
|
||||||
|
`filea,'
|
||||||
|
`fileb}c'
|
||||||
`link1'
|
`link1'
|
||||||
`noread'
|
`noread'
|
||||||
|
`{file7,}'
|
||||||
`~file4'
|
`~file4'
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -98,15 +119,21 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -m "$testdir" "*" |
|
${common_objpfx}posix/globtest -m "$testdir" "*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`*file6'
|
`*file6'
|
||||||
`-file3'
|
`-file3'
|
||||||
|
`\file9b\'
|
||||||
|
`\{file8\}'
|
||||||
|
`\{file9\,file9b\}'
|
||||||
`dir1/'
|
`dir1/'
|
||||||
`dir2/'
|
`dir2/'
|
||||||
`file1'
|
`file1'
|
||||||
`file2'
|
`file2'
|
||||||
|
`filea,'
|
||||||
|
`fileb}c'
|
||||||
`link1/'
|
`link1/'
|
||||||
`noread/'
|
`noread/'
|
||||||
|
`{file7,}'
|
||||||
`~file4'
|
`~file4'
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -119,18 +146,24 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -p "$testdir" "*" |
|
${common_objpfx}posix/globtest -p "$testdir" "*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`*file6'
|
`*file6'
|
||||||
`-file3'
|
`-file3'
|
||||||
`.'
|
`.'
|
||||||
`..'
|
`..'
|
||||||
`.file5'
|
`.file5'
|
||||||
|
`\file9b\'
|
||||||
|
`\{file8\}'
|
||||||
|
`\{file9\,file9b\}'
|
||||||
`dir1'
|
`dir1'
|
||||||
`dir2'
|
`dir2'
|
||||||
`file1'
|
`file1'
|
||||||
`file2'
|
`file2'
|
||||||
|
`filea,'
|
||||||
|
`fileb}c'
|
||||||
`link1'
|
`link1'
|
||||||
`noread'
|
`noread'
|
||||||
|
`{file7,}'
|
||||||
`~file4'
|
`~file4'
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -143,7 +176,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
|
${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`file1'
|
`file1'
|
||||||
`file2'
|
`file2'
|
||||||
EOF
|
EOF
|
||||||
@ -156,7 +189,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" |
|
${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`-file3'
|
`-file3'
|
||||||
`file1'
|
`file1'
|
||||||
`file2'
|
`file2'
|
||||||
@ -170,7 +203,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -b "$testdir" "{" |
|
${common_objpfx}posix/globtest -b "$testdir" "{" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
GLOB_NOMATCH
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -183,7 +216,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -c "$testdir" "abc" |
|
${common_objpfx}posix/globtest -c "$testdir" "abc" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`abc'
|
`abc'
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -196,7 +229,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -g "$testdir" "abc" |
|
${common_objpfx}posix/globtest -g "$testdir" "abc" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`abc'
|
`abc'
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -209,7 +242,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -g "$testdir" "abc*" |
|
${common_objpfx}posix/globtest -g "$testdir" "abc*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
GLOB_NOMATCH
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -222,7 +255,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" |
|
${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
GLOB_NOMATCH
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -235,7 +268,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "*/*" |
|
${common_objpfx}posix/globtest "$testdir" "*/*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`dir1/file1_1'
|
`dir1/file1_1'
|
||||||
`dir1/file1_2'
|
`dir1/file1_2'
|
||||||
`link1/file1_1'
|
`link1/file1_1'
|
||||||
@ -251,7 +284,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "*/1" |
|
${common_objpfx}posix/globtest "$testdir" "*/1" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
GLOB_NOMATCH
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -264,7 +297,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
|
${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`dir1/file1_1'
|
`dir1/file1_1'
|
||||||
`link1/file1_1'
|
`link1/file1_1'
|
||||||
EOF
|
EOF
|
||||||
@ -278,7 +311,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
|
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`dir1/file1_1'
|
`dir1/file1_1'
|
||||||
`dir1/file1_2'
|
`dir1/file1_2'
|
||||||
`link1/file1_1'
|
`link1/file1_1'
|
||||||
@ -293,7 +326,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
|
${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`dir1/file1_1'
|
`dir1/file1_1'
|
||||||
`link1/file1_1'
|
`link1/file1_1'
|
||||||
EOF
|
EOF
|
||||||
@ -306,7 +339,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "*-/*" |
|
${common_objpfx}posix/globtest "$testdir" "*-/*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
GLOB_NOMATCH
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -318,7 +351,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "*-" |
|
${common_objpfx}posix/globtest "$testdir" "*-" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
GLOB_NOMATCH
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -331,7 +364,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
|
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`dir1/file1_1'
|
`dir1/file1_1'
|
||||||
`dir1/file1_2'
|
`dir1/file1_2'
|
||||||
`link1/file1_1'
|
`link1/file1_1'
|
||||||
@ -347,7 +380,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
|
${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`dir1/file1_1'
|
`dir1/file1_1'
|
||||||
`dir1/file1_2'
|
`dir1/file1_2'
|
||||||
`link1/file1_1'
|
`link1/file1_1'
|
||||||
@ -363,7 +396,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
|
${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`dir1/file1_1'
|
`dir1/file1_1'
|
||||||
`dir1/file1_2'
|
`dir1/file1_2'
|
||||||
EOF
|
EOF
|
||||||
@ -377,7 +410,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -q -t "$testdir" "~" |
|
${common_objpfx}posix/globtest -q -t "$testdir" "~" |
|
||||||
sort >$testout
|
sort >$testout
|
||||||
echo ~ | cmp - $testout >> $logfile || failed=1
|
echo ~ | $CMP - $testout >> $logfile || failed=1
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
if test -d ~; then
|
if test -d ~; then
|
||||||
echo "Tilde test failed" >> $logfile
|
echo "Tilde test failed" >> $logfile
|
||||||
@ -394,9 +427,9 @@ ${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
|
|||||||
sort > $testout
|
sort > $testout
|
||||||
# Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
|
# Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
|
||||||
if test ~/ = //; then
|
if test ~/ = //; then
|
||||||
echo / | cmp - $testout >> $logfile || failed=1
|
echo / | $CMP - $testout >> $logfile || failed=1
|
||||||
else
|
else
|
||||||
echo ~/ | cmp - $testout >> $logfile || failed=1
|
echo ~/ | $CMP - $testout >> $logfile || failed=1
|
||||||
fi
|
fi
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
if test -d ~/; then
|
if test -d ~/; then
|
||||||
@ -412,7 +445,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
|
${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
eval echo ~$USER | cmp - $testout >> $logfile || failed=1
|
eval echo ~$USER | $CMP - $testout >> $logfile || failed=1
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
if eval test -d ~$USER; then
|
if eval test -d ~$USER; then
|
||||||
echo "Tilde3 test failed" >> $logfile
|
echo "Tilde3 test failed" >> $logfile
|
||||||
@ -427,7 +460,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -T "$testdir" "~file4" |
|
${common_objpfx}posix/globtest -T "$testdir" "~file4" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
GLOB_NOMATCH
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -440,7 +473,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "\**" |
|
${common_objpfx}posix/globtest "$testdir" "\**" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`*file6'
|
`*file6'
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -448,13 +481,16 @@ if test $failed -ne 0; then
|
|||||||
result=1
|
result=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ... unless NOESCAPE is used, in which case it shouldn't match anything.
|
# ... unless NOESCAPE is used, in which case it should entries with a
|
||||||
|
# leading \.
|
||||||
failed=0
|
failed=0
|
||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -e "$testdir" "\**" |
|
${common_objpfx}posix/globtest -e "$testdir" "\**" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
`\file9b\'
|
||||||
|
`\{file8\}'
|
||||||
|
`\{file9\,file9b\}'
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
echo "Star2 test failed" >> $logfile
|
echo "Star2 test failed" >> $logfile
|
||||||
@ -466,7 +502,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "\*file6" |
|
${common_objpfx}posix/globtest "$testdir" "\*file6" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`*file6'
|
`*file6'
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -474,12 +510,64 @@ if test $failed -ne 0; then
|
|||||||
result=1
|
result=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# GLOB_BRACE alone
|
||||||
|
failed=0
|
||||||
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
|
${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' |
|
||||||
|
sort > $testout
|
||||||
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
|
`{file7,}'
|
||||||
|
EOF
|
||||||
|
if test $failed -ne 0; then
|
||||||
|
echo "Brace4 test failed" >> $logfile
|
||||||
|
result=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# GLOB_BRACE and GLOB_NOESCAPE
|
||||||
|
failed=0
|
||||||
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
|
${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' |
|
||||||
|
sort > $testout
|
||||||
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
|
`\file9b\'
|
||||||
|
EOF
|
||||||
|
if test $failed -ne 0; then
|
||||||
|
echo "Brace5 test failed" >> $logfile
|
||||||
|
result=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escaped comma
|
||||||
|
failed=0
|
||||||
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
|
${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' |
|
||||||
|
sort > $testout
|
||||||
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
|
`filea,'
|
||||||
|
EOF
|
||||||
|
if test $failed -ne 0; then
|
||||||
|
echo "Brace6 test failed" >> $logfile
|
||||||
|
result=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escaped closing brace
|
||||||
|
failed=0
|
||||||
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
|
${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' |
|
||||||
|
sort > $testout
|
||||||
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
|
`fileb}c'
|
||||||
|
EOF
|
||||||
|
if test $failed -ne 0; then
|
||||||
|
echo "Brace7 test failed" >> $logfile
|
||||||
|
result=1
|
||||||
|
fi
|
||||||
|
|
||||||
# Try a recursive failed search
|
# Try a recursive failed search
|
||||||
failed=0
|
failed=0
|
||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
|
${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
GLOB_NOMATCH
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -492,7 +580,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
|
${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
GLOB_NOMATCH
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -505,7 +593,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "noread/*" |
|
${common_objpfx}posix/globtest "$testdir" "noread/*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
GLOB_NOMATCH
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -517,7 +605,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "noread*/*" |
|
${common_objpfx}posix/globtest "$testdir" "noread*/*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_NOMATCH
|
GLOB_NOMATCH
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -535,14 +623,14 @@ if test "$user" != root; then
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -E "$testdir" "noread/*" |
|
${common_objpfx}posix/globtest -E "$testdir" "noread/*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_ABORTED
|
GLOB_ABORTED
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
|
${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
GLOB_ABORTED
|
GLOB_ABORTED
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
@ -556,7 +644,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
|
${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`dir1/file1_1'
|
`dir1/file1_1'
|
||||||
`dir1/file1_2'
|
`dir1/file1_2'
|
||||||
`file1'
|
`file1'
|
||||||
@ -573,7 +661,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
|
${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`abc'
|
`abc'
|
||||||
`dir1/file1_1'
|
`dir1/file1_1'
|
||||||
`dir1/file1_2'
|
`dir1/file1_2'
|
||||||
@ -591,7 +679,7 @@ failed=0
|
|||||||
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
|
||||||
${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
|
${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
|
||||||
sort > $testout
|
sort > $testout
|
||||||
cat <<"EOF" | cmp - $testout >> $logfile || failed=1
|
cat <<"EOF" | $CMP - $testout >> $logfile || failed=1
|
||||||
`*/blahblah'
|
`*/blahblah'
|
||||||
EOF
|
EOF
|
||||||
if test $failed -ne 0; then
|
if test $failed -ne 0; then
|
||||||
|
@ -195,12 +195,6 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
|
|||||||
it internally. */
|
it internally. */
|
||||||
*label = 0x41;
|
*label = 0x41;
|
||||||
label = bp++;
|
label = bp++;
|
||||||
/* Another simplification: always assume
|
|
||||||
128 bit number. */
|
|
||||||
if (bp + 16 >= eom) {
|
|
||||||
__set_errno (EMSGSIZE);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
++src;
|
++src;
|
||||||
while (isxdigit (*src)) {
|
while (isxdigit (*src)) {
|
||||||
n = *src > '9' ? *src - 'a' + 10 : *src - '0';
|
n = *src > '9' ? *src - 'a' + 10 : *src - '0';
|
||||||
@ -211,6 +205,10 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
|
|||||||
}
|
}
|
||||||
n <<= 4;
|
n <<= 4;
|
||||||
n += *src > '9' ? *src - 'a' + 10 : *src - '0';
|
n += *src > '9' ? *src - 'a' + 10 : *src - '0';
|
||||||
|
if (bp + 1 >= eom) {
|
||||||
|
__set_errno (EMSGSIZE);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
*bp++ = n;
|
*bp++ = n;
|
||||||
++src;
|
++src;
|
||||||
}
|
}
|
||||||
|
@ -339,11 +339,7 @@ extern int getlogin_r __P ((char *, size_t));
|
|||||||
extern char *getlogin __P ((void));
|
extern char *getlogin __P ((void));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static
|
static const char *next_brace_sub __P ((const char *begin, int flags));
|
||||||
#if __GNUC__ - 0 >= 2
|
|
||||||
inline
|
|
||||||
#endif
|
|
||||||
const char *next_brace_sub __P ((const char *begin));
|
|
||||||
|
|
||||||
#endif /* GLOB_ONLY_P */
|
#endif /* GLOB_ONLY_P */
|
||||||
|
|
||||||
@ -357,20 +353,29 @@ static int prefix_array __P ((const char *prefix, char **array, size_t n));
|
|||||||
static int collated_compare __P ((const __ptr_t, const __ptr_t));
|
static int collated_compare __P ((const __ptr_t, const __ptr_t));
|
||||||
|
|
||||||
|
|
||||||
/* Find the end of the sub-pattern in a brace expression. We define
|
/* Find the end of the sub-pattern in a brace expression. */
|
||||||
this as an inline function if the compiler permits. */
|
static const char *
|
||||||
static
|
next_brace_sub (cp, flags)
|
||||||
#if __GNUC__ - 0 >= 2
|
|
||||||
inline
|
|
||||||
#endif
|
|
||||||
const char *
|
|
||||||
next_brace_sub (cp)
|
|
||||||
const char *cp;
|
const char *cp;
|
||||||
|
int flags;
|
||||||
{
|
{
|
||||||
unsigned int depth = 0;
|
unsigned int depth = 0;
|
||||||
while (*cp != '\0' && (*cp != '}' || depth--) && (*cp != ',' || depth))
|
while (*cp != '\0')
|
||||||
if (*cp++ == '{')
|
if ((flags & GLOB_NOESCAPE) == 0 && *cp == '\\')
|
||||||
depth++;
|
{
|
||||||
|
if (*++cp == '\0')
|
||||||
|
break;
|
||||||
|
++cp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((*cp == '}' && depth-- == 0) || (*cp == ',' && depth == 0))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (*cp++ == '{')
|
||||||
|
depth++;
|
||||||
|
}
|
||||||
|
|
||||||
return *cp != '\0' ? cp : NULL;
|
return *cp != '\0' ? cp : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +415,30 @@ glob (pattern, flags, errfunc, pglob)
|
|||||||
|
|
||||||
if (flags & GLOB_BRACE)
|
if (flags & GLOB_BRACE)
|
||||||
{
|
{
|
||||||
const char *begin = strchr (pattern, '{');
|
const char *begin;
|
||||||
|
|
||||||
|
if (flags & GLOB_NOESCAPE)
|
||||||
|
begin = strchr (pattern, '{');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
begin = pattern;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (*begin == '\0')
|
||||||
|
{
|
||||||
|
begin = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*begin == '\\' && begin[1] != '\0')
|
||||||
|
++begin;
|
||||||
|
else if (*begin == '{')
|
||||||
|
break;
|
||||||
|
|
||||||
|
++begin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (begin != NULL)
|
if (begin != NULL)
|
||||||
{
|
{
|
||||||
/* Allocate working buffer large enough for our work. Note that
|
/* Allocate working buffer large enough for our work. Note that
|
||||||
@ -429,8 +457,8 @@ glob (pattern, flags, errfunc, pglob)
|
|||||||
{
|
{
|
||||||
if (!(flags & GLOB_APPEND))
|
if (!(flags & GLOB_APPEND))
|
||||||
{
|
{
|
||||||
globfree (pglob);
|
|
||||||
pglob->gl_pathc = 0;
|
pglob->gl_pathc = 0;
|
||||||
|
pglob->gl_pathv = NULL;
|
||||||
}
|
}
|
||||||
return GLOB_NOSPACE;
|
return GLOB_NOSPACE;
|
||||||
}
|
}
|
||||||
@ -446,7 +474,7 @@ glob (pattern, flags, errfunc, pglob)
|
|||||||
|
|
||||||
/* Find the first sub-pattern and at the same time find the
|
/* Find the first sub-pattern and at the same time find the
|
||||||
rest after the closing brace. */
|
rest after the closing brace. */
|
||||||
next = next_brace_sub (begin + 1);
|
next = next_brace_sub (begin + 1, flags);
|
||||||
if (next == NULL)
|
if (next == NULL)
|
||||||
{
|
{
|
||||||
/* It is an illegal expression. */
|
/* It is an illegal expression. */
|
||||||
@ -460,7 +488,7 @@ glob (pattern, flags, errfunc, pglob)
|
|||||||
rest = next;
|
rest = next;
|
||||||
while (*rest != '}')
|
while (*rest != '}')
|
||||||
{
|
{
|
||||||
rest = next_brace_sub (rest + 1);
|
rest = next_brace_sub (rest + 1, flags);
|
||||||
if (rest == NULL)
|
if (rest == NULL)
|
||||||
{
|
{
|
||||||
/* It is an illegal expression. */
|
/* It is an illegal expression. */
|
||||||
@ -525,7 +553,7 @@ glob (pattern, flags, errfunc, pglob)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
p = next + 1;
|
p = next + 1;
|
||||||
next = next_brace_sub (p);
|
next = next_brace_sub (p, flags);
|
||||||
assert (next != NULL);
|
assert (next != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1276,7 +1304,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
|
|||||||
nfound = 0;
|
nfound = 0;
|
||||||
}
|
}
|
||||||
else if (meta == 0 &&
|
else if (meta == 0 &&
|
||||||
((flags & GLOB_NOESCAPE) || strchr(pattern, '\\') == NULL))
|
((flags & GLOB_NOESCAPE) || strchr (pattern, '\\') == NULL))
|
||||||
{
|
{
|
||||||
/* Since we use the normal file functions we can also use stat()
|
/* Since we use the normal file functions we can also use stat()
|
||||||
to verify the file is there. */
|
to verify the file is there. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user