This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libtool quoting error


[Cygwinners: Taking this to the Libtool lists]
[Libtoolers: Following up on a post on the cygwin mailing list]

On 2012-08-19 19:03, Andreas Schiffler wrote:
> The libtool distributed with cygwin has a bug that prevents use in paths containing spaces.
> This was encountered when trying to build SDL2 on Windows (see http://bugzilla.libsdl.org/show_bug.cgi?id=1575 for details or repro).
> 
> # Which release of libtool.m4 was used?
> macro_version=2.2.6
> macro_revision=1.3012
> 
> The fix is simple: add additional quoting.
> 
> $ diff libtool libtool-fixed
> 2797c2797
> <       exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
> ---
>>       exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
> 8321c8321
> <       if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
> ---
>>       if test "X$ECHO" = "X$SHELL \"$progpath\" --fallback-echo"; then
> 8323,8324c8323,8324
> <       [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
> <       *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
> ---
>>       [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL \"$progpath\" --fallback-echo";;
>>       *) qecho="$SHELL `pwd`/\"$progpath\" --fallback-echo";;
> 8559c8559
> <       relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
> ---
>>       relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"

The code changed in the two middle hunks went out after 2.2.6 and
are thus gone in 2.2.8 and later, so that no longer applies.

I also took the liberty of changing ltmain.m4sh instead of the
generated libtool script.

So, this is a better attempt for a patch, with Andreas added to
THANKS.

Ok to push?

Cheers,
Peter

>From c50b8d27d5832ca1c962bf3dec46c1b85eff5bad Mon Sep 17 00:00:00 2001
From: Peter Rosin <peda@lysator.liu.se>
Date: Sun, 19 Aug 2012 22:06:06 +0200
Subject: [PATCH] libtool: quote progpath properly

Attempt to handle spaces in paths better.

* build-aux/ltmain.m4sh (func_mode_install, func_mode_link): Quote
$progpath.
* THANKS: Update.
---
 THANKS                |    1 +
 build-aux/ltmain.m4sh |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/THANKS b/THANKS
index 84cb6c9..24f1c91 100644
--- a/THANKS
+++ b/THANKS
@@ -70,6 +70,7 @@
   Alan Hourihane		alanh@fairlite.co.uk
   Alexei Sheplyakov		varg@theor.jinr.ru
   Alon Bar-Lev			alon.barlev@gmail.com
+  Andreas Schiffler		aschiffler@ferzkopp.net
   Andreas Schwab		schwab@suse.de
   Andrey Slepuhin		pooh@msu.ru
   Aneesh Kumar K.V		kvaneesh@hotmail.com
diff --git a/build-aux/ltmain.m4sh b/build-aux/ltmain.m4sh
index 30f99f4..968b727 100644
--- a/build-aux/ltmain.m4sh
+++ b/build-aux/ltmain.m4sh
@@ -2449,7 +2449,7 @@ func_mode_install ()
     if test -n "$current_libdirs"; then
       # Maybe just do a dry run.
       $opt_dry_run && current_libdirs=" -n$current_libdirs"
-      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+      exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
     else
       exit $EXIT_SUCCESS
     fi
@@ -8506,7 +8506,7 @@ EOF
 	fi
       done
       # Quote the link command for shipping.
-      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command="(cd `pwd`; $SHELL "$progpath" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
       relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
       if test yes = "$hardcode_automatic"; then
 	relink_command=
-- 
1.7.9


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]