libtool-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 6/6] use print or printf or cat as $ECHO (really)


From: Ralf Wildenhues
Subject: Re: [PATCH 6/6] use print or printf or cat as $ECHO (really)
Date: Sat, 22 Nov 2008 14:57:06 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Hello again,

* Paolo Bonzini wrote on Mon, Nov 10, 2008 at 02:16:03PM CET:
> * libltdl/m4/libtool.m4 (LT_INIT): Add _LT_SHELL_INIT to
> work around Autoconf <2.64 bug.
> (_LT_OUTPUT_LIBTOOL_COMMANDS_INIT): Add func_fallback_echo.
> Eliminate lt_ECHO requoting.
> (_LT_SHELL_INIT): Use a public M4sh diversion.
> (_LT_PROG_ECHO_BACKSLASH): Rewrite.
> (LT_CMD_MAX_LEN): Do not use --fallback-echo.
> * libltdl/config/ltmain.m4sh: Remove --no-reexec and --fallback-echo
> handling.
> (func_fallback_echo): New.
> (func_emit_wrapper_part1): Quote ECHO.  Remove --no-reexec and
> --fallback-echo handling.
> (Execute mode): Do not set qecho.

> --- a/libltdl/m4/libtool.m4
> +++ b/libltdl/m4/libtool.m4
[...]
> +m4_ifdef([_AS_DETECT_SUGGESTED],
> +[_AS_DETECT_SUGGESTED([
> +  
> ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
> +  ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
> +  ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
> +  PATH=/tmp/nonexistent; export PATH;
> +  FPATH=$PATH; export FPATH;
> +  test "X`printf %s $ECHO`" = "X$ECHO"])])

IIUC then this code has two problems: first, it changes PATH and FPATH
for any _AS_DETECT_SUGGESTED shell snippets expanded right after this
one.  Second, it uses an unsafe replacement path (this problem stems
from before your patch).

I propose two alternative patches to fix these issues.  Both, as the
code before the patch, assume that `test' is a built-in command.  Yuck.
The first patch further assumes that, since `test' is not a special
built-in, the shell will take care to change the variables for the
duration of the following command only.  Do we have reason to believe
this not to be portable?

In case of doubt, I guess the second approach using a subshell should be
feasible.  Another idea would be to save and restore the variables,
which incurs the obvious complications for treating unset variables.

Thoughts?

Thanks,
Ralf

        * libltdl/m4/libtool.m4 (_LT_PROG_ECHO_BACKSLASH): Fix test to
        not influence further tests registered with _AS_DETECT_SUGGESTED
        and do not use a PATH below /tmp, to avoid influence by a third
        party.

diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 7fbf965..78370b1 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -1117,9 +1117,7 @@ m4_ifdef([_AS_DETECT_SUGGESTED],
   
ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
   ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
   ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-  PATH=/tmp/nonexistent; export PATH;
-  FPATH=$PATH; export FPATH;
-  test "X`printf %s $ECHO`" = "X$ECHO"])])
+  PATH=/empty FPATH=/empty test "X`printf %s $ECHO`" = "X$ECHO"])])
 
 _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
 _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])



diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 7fbf965..548863c 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -1117,9 +1117,8 @@ m4_ifdef([_AS_DETECT_SUGGESTED],
   
ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
   ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
   ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-  PATH=/tmp/nonexistent; export PATH;
-  FPATH=$PATH; export FPATH;
-  test "X`printf %s $ECHO`" = "X$ECHO"])])
+  ( PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" )])])
 
 _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
 _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])




reply via email to

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