Why change posix/globtest.sh?

H . J . Lu hjl@lucon.org
Tue Apr 18 20:18:00 GMT 2000


On Tue, Apr 18, 2000 at 07:36:02PM -0700, Ulrich Drepper wrote:
> "H . J . Lu" <hjl@lucon.org> writes:
> 
> >  ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
> >  ${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
> >  sort > $testout
> > -eval echo ~$USER | cmp - $testout || result=1
> > +# Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
> > +if test ~/ = //; then
> > +    echo / | cmp - $testout || result=1
> > +else
> > +    echo ~/ | cmp - $testout || result=1
> > +fi
> > 
> > UIlrich, I believe you applied the patch at the wrong place. Could
> > you please fix it?
> 
> Why should this be wrong?  Some shells expand ~/ for $HOME == / to //.
> We expect / and therefore we have to have a special test.
> 

This is the patch for glibc 2.1. Please read PR libc/1690 and glibc
2.2. I didn't figure it out until I read PR libc/1690 and glibc 2.2.


H.J.
--
2000-04-18  H.J. Lu  <hjl@gnu.org>

        * posix/globtest.sh: Properly apply the patch by Ulrich Drepper
        <drepper@redhat.com> on 2000-04-13.


--- ../../import/glibc-2.1/libc/posix/globtest.sh	Thu Apr 13 20:25:20 2000
+++ posix/globtest.sh	Tue Apr 18 17:29:46 2000
@@ -211,18 +211,18 @@ echo ~ | cmp - $testout || result=1
 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
 ${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
 sort > $testout
-echo ~/ | cmp - $testout || result=1
-
-# Test tilde expansion with username
-${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
-${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
-sort > $testout
 # Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
 if test ~/ = //; then
     echo / | cmp - $testout || result=1
 else
     echo ~/ | cmp - $testout || result=1
 fi
+
+# Test tilde expansion with username
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
+sort > $testout
+eval echo ~$USER | cmp - $testout || result=1
 
 # Tilde expansion shouldn't match a file
 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \


More information about the Libc-hacker mailing list