Subject: Re: bug#17478: "No such file or directoryn" due to incorrect escaping

From: Peter Rosin <[email-masked]>
Date: Tue, 13 May 2014 11:50:42 +0200

On 2014-05-13 11:36, Peter Rosin wrote:
> On 2014-05-13 10:57, Egmont Koblinger wrote:
>>> I believe this line is generated from these lines of libtool.m4 and
>>> ltmain.sh (attaching these too):
>>> libtool.m4:1183:   ECHO='printf %s\n'
>>> ltmain.sh:4069:      $ECHO \"\$relink_command_output\" >&2
> 
> Looks likely.
> 
> I think you should try to prepend \ to that $ECHO, I'll send a patch
> for libtool proper shortly. Not sure how you should test this though,
> when you are using the system libtool...
> 
> I.e. try to change that line to:
>       \$ECHO \"\$relink_command_output\" >&2

Patch attached, as promised.

I'll hold of pushing this until I get some feedback.

Cheers,
Peter

>From ac180507c123469d0fe9b25437d459af24b3f789 Mon Sep 17 00:00:00 2001
From: Peter Rosin <[email-masked]>
Date: Tue, 13 May 2014 11:47:54 +0200
Subject: [PATCH] libtool: delay expansion of $ECHO until the wrapper script
 runs

Expanding $ECHO too early leads to unquoted \n when ECHO='printf %s\n'.

Fixes bug#17478. Reported by Egmont Koblinger.

* build-aux/ltmain.in (func_emit_wrapper) [fast_install]: Quote the
$ECHO, and delay the expansion.

Signed-off-by: Peter Rosin <[email-masked]>
---
 build-aux/ltmain.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 6af4087..65b5a2d 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -3514,7 +3514,7 @@ func_exec_program ()
     if test -n \"\$relink_command\"; then
       if relink_command_output=\`eval \$relink_command 2>&1\`; then :
       else
-	$ECHO \"\$relink_command_output\" >&2
+	\$ECHO \"\$relink_command_output\" >&2
 	$RM \"\$progdir/\$file\"
 	exit 1
       fi
-- 
1.7.9