[Top][All Lists]

[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: Wed, 9 Mar 2005 18:53:07 +0100
User-agent: Mutt/1.5.6+20040907i

Hi Per,

* Per Bothner wrote on Mon, Mar 07, 2005 at 08:18:07PM CET:
> Ralf Wildenhues wrote:
> >Thanks for reporting this.  Your patch is not quite correct, as it
> >causes the $ in the libobj name to be quoted twice.  Thus, the output
> >name of the .lo file will be wrong.
> Hm.  Yes.

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.

> If you compile .class files one-by-one (not using the multiple-input-file
> support), you'd probably also want $-support for output files, though that's
> not an issue for me.

This is not supported yet.

> >> libtool --mode=compile gcj *.class -o package.lo
> >>It appears that func_mode_compile sets srcfile to the *last*
> >>source file; setting it to the first source file might be better.
*snip a lot*

It's infeasible to find out which arguments are source files and which
are arguments to compiler command line options.  Libtool has enough
trouble with this for link mode.  For compile mode, the current
heuristic works reasonably.

Thank you, BTW, for the nice explanations.

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.

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  9 Mar 2005 16:58:29 -0000
@@ -1279,6 +1279,9 @@
+    func_quote_for_eval "$srcfile"
+    qsrcfile=$func_quote_for_eval_result
     # Calculate the filename of the output object if compiler does
     # not support -o with -c
     if test "$compiler_c_o" = no; then
@@ -1315,11 +1318,13 @@
        $opt_dry_run || $RM $removelist
        exit $EXIT_FAILURE
-      $ECHO $srcfile > "$lockfile"
+      $ECHO "$srcfile" > "$lockfile"
     if test -n "$fix_srcfile_path"; then
       eval srcfile=\"$fix_srcfile_path\"
+      func_quote_for_eval "$srcfile"
+      qsrcfile=$func_quote_for_eval_result
     $opt_dry_run || $RM "$libobj" "${libobj}T"
@@ -1342,10 +1347,10 @@
       if test "$pic_mode" != no; then
-       command="$base_compile $srcfile $pic_flag"
+       command="$base_compile $qsrcfile $pic_flag"
        # Don't build PIC code
-       command="$base_compile $srcfile"
+       command="$base_compile $qsrcfile"
       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"
-       command="$base_compile $srcfile $pic_flag"
+       command="$base_compile $qsrcfile $pic_flag"
       if test "$compiler_c_o" = yes; then
        command="$command -o $obj"

reply via email to

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