libtool-patches
[Top][All Lists]
Advanced

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

Re: patch to fix missing quoting


From: Ralf Wildenhues
Subject: Re: patch to fix missing quoting
Date: Thu, 10 Mar 2005 10:52:56 +0100
User-agent: Mutt/1.4.1i

Sorry for self-reply.

* Ralf Wildenhues wrote on Wed, Mar 09, 2005 at 06:53:07PM CET:
> 
> OK.  I've got something half-working here.  It allows merely adding
> weird characters to the source file names.  You absolutely have to
> specify a "nice" output name with `-o'.  Maybe libtool should refuse
> to work without `-o' when it finds special characters in srcfile?
> 
> I peeked at allowing general object names, but allowing x$y.lo as
> libtool object requires looking at many places all over ltmain.m4sh.
> 
> Would this serve your purpose?  Does the patch below work for you
> (against HEAD; should apply to branch-2-0)?
> 
> Then I'd need someone with cygwin plus MSVC to test the change.
> I really think the whole $fix_srcfile_path was broken before, because
> its output was not quoted but evaled (and that would most certainly be
> an issue with the C:\foo\bar stuff which `cygpath -w' outputs).
> 
> So, this patch actually fixes that plus another tiny issue as well,
> namely to correctly quote the srcfile name written into the lockfile
> for `-c -o' incapable compilers.

OK, better patch: does the quoting only in one place, plus complains
loudly and fails if $libobj contains special characters.  I fear a
little that the test may unveil more shell pattern bugs, thinking back
to http://lists.gnu.org/archive/html/bug-libtool/2004-12/msg00096.html,
which took a looong time to figure out correctly.

Still: OK to apply to HEAD/branch-2-0 and backport to branch-1-5?


Side note: two different variables for quoted/unquoted srcfile are
necessary because the quoted name may not be OK to use as filename
for the lockfile.  The other possibility would be to eval all the
other commands as well, but I feel that could introduce more problems.

Besides, if we were to allow general object names, I would like the
{non_,}pic_object names stored in .lo to be unescaped (file contents
should be as little shell-dependent as possible to save us from future
complications).

Regards,
Ralf

2005-03-06  Per Bothner <address@hidden>,
            Ralf Wildenhues  <address@hidden>

        Allow special characters in source file names.  Will break unless
        `-o target' is also given, which must not contain special characters.
        En passant, fix source file quoting broken for cygwin/MSVC.

        * ltmain.m4sh (func_mode_compile): Use new variable qsrcfile
        for quoted source file name for compile $command.  Fix missing
        quotes for _c_o lockfile.
        * NEWS: Update.

Index: NEWS
===================================================================
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.178
diff -u -r1.178 NEWS
--- NEWS        4 Feb 2005 15:47:40 -0000       1.178
+++ NEWS        10 Mar 2005 09:58:38 -0000
@@ -8,6 +8,8 @@
 * Shell optimizations which break use of the stdin file descriptor in libtool.
 * `libtoolize --install' now also installs `install-sh'.
 * Support (mostly) for DragonFly BSD.
+* Allow shell special characters like `$' in source file names, but not
+  in object names, to enhance GCJ support.
 
 New in 1.9h: 2004-??-??; CVS version 1.9g, Libtool team:
 * Libtool versions can now be parallel installed, except that only one
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.56
diff -u -r1.56 ltmain.m4sh
--- config/ltmain.m4sh  23 Feb 2005 03:30:30 -0000      1.56
+++ config/ltmain.m4sh  10 Mar 2005 09:43:35 -0000
@@ -1249,6 +1249,9 @@
       esac
     done
 
+    func_quote_for_eval "$libobj"
+    test "X$libobj" != "X$func_quote_for_eval_result" \
+      && func_fatal_error "libobj name \`$libobj' may not contain shell 
special characters."
     func_basename "$obj"
     objname="$func_basename_result"
     func_dirname "$obj" "/" ""
@@ -1315,12 +1318,14 @@
        $opt_dry_run || $RM $removelist
        exit $EXIT_FAILURE
       fi
-      $ECHO $srcfile > "$lockfile"
+      $ECHO "$srcfile" > "$lockfile"
     fi
 
     if test -n "$fix_srcfile_path"; then
       eval srcfile=\"$fix_srcfile_path\"
     fi
+    func_quote_for_eval "$srcfile"
+    qsrcfile=$func_quote_for_eval_result
 
     $opt_dry_run || $RM "$libobj" "${libobj}T"
 
@@ -1342,10 +1347,10 @@
       fbsd_hideous_sh_bug=$base_compile
 
       if test "$pic_mode" != no; then
-       command="$base_compile $srcfile $pic_flag"
+       command="$base_compile $qsrcfile $pic_flag"
       else
        # Don't build PIC code
-       command="$base_compile $srcfile"
+       command="$base_compile $qsrcfile"
       fi
 
       func_mkdir_p "$xdir$objdir"
@@ -1409,9 +1414,9 @@
     if test "$build_old_libs" = yes; then
       if test "$pic_mode" != yes; then
        # Don't build PIC code
-       command="$base_compile $srcfile"
+       command="$base_compile $qsrcfile"
       else
-       command="$base_compile $srcfile $pic_flag"
+       command="$base_compile $qsrcfile $pic_flag"
       fi
       if test "$compiler_c_o" = yes; then
        command="$command -o $obj"




reply via email to

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