[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: factor sed_quote_subst into func_quote_for_expand [libtool--release
From: |
Gary V. Vaughan |
Subject: |
FYI: factor sed_quote_subst into func_quote_for_expand [libtool--release--2.0--patch-32] |
Date: |
Wed, 20 Oct 2004 09:43:06 +0100 (BST) |
User-agent: |
mailnotify/0.5 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Applied to branch-2-0 and HEAD.
* looking for address@hidden/libtool--release--2.0--patch-31 to compare with
* comparing to address@hidden/libtool--release--2.0--patch-31
M ChangeLog
M config/ltmain.m4sh
M m4/libtool.m4
M config/general.m4sh
* modified files
Index: Changelog
from Noah Misch <address@hidden>,
Gary V. Vaughan <address@hidden>
* m4/libtool.m4 (sed_quote_subst): Remove superfluous backslashes
from the match character set.
(double_quote_subst): Ditto.
* lib/general.m4sh (sed_quote_subst): Ditto.
(double_quote_subst): New variable, copied from
m4/libtool.m4. Much the same as sed_quote_subst, but variable
references are not quoted.
(func_quote_for_eval): Given any $foo; $bar and
$foo must be identical after the following commands:
func_quote_for_eval "$foo"
eval "bar=$func_quote_for_eval_result"
(func_quote_for_expand): In a similar vein to to func_quote_for_eval,
except that variable expansions are not protected when quoting the
command for subsequent display.
* config/ltmain.m4sh: Factor away use of $sed_quote_subst now that
it has been subsumed into func_quote_for_eval.
(func_mode_link): Instead of `2004-10-14 Peter O'Gorman' below,
use func_quote_for_expand so that ${wl} is expanded properly in
the $show expression.
--- orig/config/general.m4sh
+++ mod/config/general.m4sh
@@ -89,7 +89,11 @@
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([[\\`\\"$\\\\]]\)/\\\1/g'
+sed_quote_subst='s/\([[`"$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
# test EBCDIC or ASCII
case `$ECHO A|tr A '\301'` in
A) # EBCDIC based system
@@ -252,10 +256,12 @@
# Aesthetically quote ARG to be evaled later.
func_quote_for_eval ()
{
- my_arg="$1"
+ my_arg=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"`
case $my_arg in
- # Double-quote args containing other shell metacharacters.
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting, command substitution and and variable
+ # expansion for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[[\@<:@\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]]*|*@:>@*|"")
@@ -264,4 +270,25 @@
esac
func_quote_for_eval_result="$my_arg"
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+ my_arg=`$ECHO "X$1" | $Xsed -e "$double_quote_subst"`
+
+ case $my_arg in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting and command substitution for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[[\@<:@\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]]*|*@:>@*|"")
+ my_arg="\"$my_arg\""
+ ;;
+ esac
+
+ func_quote_for_expand_result="$my_arg"
}
--- orig/config/ltmain.m4sh
+++ mod/config/ltmain.m4sh
@@ -1090,7 +1090,6 @@
esac # case $arg_mode
# Aesthetically quote the previous argument.
- lastarg=`$ECHO "X$lastarg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$lastarg"
base_compile="$base_compile $func_quote_for_eval_result"
done # for arg
@@ -1511,8 +1510,8 @@
;;
esac
# Quote arguments (to preserve shell metacharacters).
- file=`$ECHO "X$file" | $Xsed -e "$sed_quote_subst"`
- args="$args \"$file\""
+ func_quote_for_eval "$file"
+ args="$args $func_quote_for_eval_result"
done
if test -z "$run"; then
@@ -1637,8 +1636,7 @@
# Allow the use of GNU shtool's install command.
$ECHO "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then
# Aesthetically quote it.
- arg=`$ECHO "X$nonopt" | $Xsed -e "$sed_quote_subst"`
- func_quote_for_eval "$arg"
+ func_quote_for_eval "$nonopt"
install_prog="$func_quote_for_eval_result "
arg="$1"
shift
@@ -1649,7 +1647,6 @@
# The real first argument should be the name of the installation program.
# Aesthetically quote it.
- arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$arg"
install_prog="$install_prog$func_quote_for_eval_result"
@@ -1693,7 +1690,6 @@
esac
# Aesthetically quote the argument.
- arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$arg"
install_prog="$install_prog $func_quote_for_eval_result"
done
@@ -2199,7 +2195,7 @@
arg="$1"
shift
qarg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
- func_quote_for_eval "$qarg"
+ func_quote_for_eval "$arg"
libtool_args="$libtool_args $func_quote_for_eval_result"
# If the previous option needs an argument, assign it.
@@ -2716,7 +2712,7 @@
;;
-Wc,*)
- args=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+ args=`$ECHO "X$arg" | $Xsed -e 's/^-Wc,//'`
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
@@ -2730,7 +2726,7 @@
;;
-Wl,*)
- args=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ args=`$ECHO "X$arg" | $Xsed -e 's/^-Wl,//'`
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
@@ -2765,7 +2761,6 @@
# -q* pass through compiler args for the IBM compiler
# -m* pass through architecture-specific compiler args for GCC
-64|-mips[[0-9]]|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
- arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
compile_command="$compile_command $arg"
@@ -2776,7 +2771,6 @@
# Some other compiler flag.
-* | +*)
- arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
@@ -2910,7 +2904,6 @@
*)
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
- arg=`$ECHO "X$arg" | $Xsed -e "$sed_quote_subst"`
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
@@ -5144,8 +5137,8 @@
for cmd in $cmds; do
IFS="$save_ifs"
eval cmd=\"$cmd\"
- func_quote_for_eval "$cmd"
- eval \$show \"$func_quote_for_eval_result\"
+ func_quote_for_expand "$cmd"
+ eval \$show "$func_quote_for_expand_result"
$run eval "$cmd" || {
lt_exit=$?
@@ -5593,8 +5586,8 @@
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
- var_value=`$ECHO "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var;
$relink_command"
fi
done
relink_command="(cd `pwd`; $relink_command)"
@@ -6283,8 +6276,8 @@
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
- var_value=`$ECHO "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var;
$relink_command"
fi
done
# Quote the link command for shipping.
--- orig/m4/libtool.m4
+++ mod/m4/libtool.m4
@@ -135,10 +135,10 @@
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed='sed -e s/^X//'
-[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
# Same as above, but do not quote variable references.
-[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
# Sed substitution to delay expansion of an escaped shell variable in a
# double_quote_subst'ed string.
- --
Gary V. Vaughan ())_. address@hidden,gnu.org}
Research Scientist ( '/ http://tkd.kicks-ass.net
GNU Hacker / )= http://www.gnu.org/software/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook
_________________________________________________________
This patch notification generated by tlaapply version 0.8
http://tkd.kicks-ass.net/arch/address@hidden/cvs-utils--tla--1.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFBdiUZFRMICSmD1gYRAlNOAKCD1jmrUF7aZOR3PBnuMz1meKSBHACfam88
I9sQjnltu6fcjEdTVe7qHKo=
=HVtA
-----END PGP SIGNATURE-----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: factor sed_quote_subst into func_quote_for_expand [libtool--release--2.0--patch-32],
Gary V. Vaughan <=