[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [4/11] Native MSVC support (file-magic-glob)

From: Charles Wilson
Subject: Re: [4/11] Native MSVC support (file-magic-glob)
Date: Thu, 12 Jul 2007 03:32:18 -0400
User-agent: Thunderbird (Windows/20070509)

Peter Rosin wrote:
        * libltdl/m4/libtool.m4 (_LT_CHECK_MAGIC_METHOD),
        libltdl/config/ltmain.m4sh (func_mode_link): On Windows,
        find potential libs regardless of file name case.

Hmm. Well, this one might pose some problems. On cygwin, there exists something called "managed mounts" where cygwin transmogrifies all filenames (using RFC2396 encoding -- see section 2.4) to work around the limitations of Windows' filesystems.

In particular, it allows you to have distinct files in the same directory whose names differ only in case. e.g.

FOO.a ==> %46%4F%4F.a
Foo.a ==> %46oo.a
foo.a ==> foo.a

(If you look at the directory using a non-cygwin app, the files are actually names as they appear in the right hand column above)

If managed mounts are in use, and some idiot actually has libraries like this [*], what does -lfoo mean? With this patch, it seems a bit -- well, not really random, but non-intuitive and unpredictable to the casual user. Whichever of FOO.a, Foo.a, or foo.a is returned first by the shell glob -- which may differ depending on $SHELL and the underlying glob implementation[**] -- is the one you get.

OTOH, this may be a case of "Doctor, it hurts when I do this", "OK, don't do that then": don't be stupid when naming distinct libraries. If you insist on being stupid, we can't help you.

In fact, I rather lean toward this approach -- and to accepting Peter's patch in principle. There is such a thing as being TOO defensive when programming.

As to gods.  Turning every libname into


by using this sed expr

s/[aA]/[aA]/g;s/[bB]/[bB]/g;<22 more>;s/[yY]/[yY]/g;s/[zZ]/[zZ]/g;

Isn't there a better way? (I can't think of one offhand, given how this is used to generate a list of "potential_libs", but still...this can't be very efficient.)


[*] on my generic linux box,
ls -1 /usr/lib | tr '[:lower:]' '[:upper:]' | sort | uniq -d
has no hits.  So linux isn't stupid.

[**] the cygwin kernel's glob -- which may or may not be used by $SHELL -- in CVS HEAD was changed a while back, so behavior under snapshots/1.7.0 *may* differ from current cygwin 1.5.24.

+               if test -n "$file_magic_glob"; then
+                 libnameglob=`$ECHO "X$libname" | $Xsed -e $file_magic_glob`
+               else
+                 libnameglob=$libname
+               fi
                for i in $lib_search_path $sys_lib_search_path 
$shlib_search_path; do
-                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
                  for potent_lib in $potential_libs; do

+case $host_os in
+cygwin* | mingw* | pw32*)
+  file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e 
+  ;;
+  file_magic_glob=
+  ;;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]