From: Alexandre Oliva Date: Thu, 4 Nov 1999 16:15:50 +0000 (+0000) Subject: * tests/sh.test: New test to detect uses of quotes within X-Git-Tag: multi-language-fork~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8f4d31885a4a05a6538269ed51e908981224c2c7;p=thirdparty%2Flibtool.git * tests/sh.test: New test to detect uses of quotes within backticks within quotes. * ltconfig.in, ltmain.in: Fix detected errors. Mark false positives with a comment that disables the detector. Reported by Akim Demaille --- diff --git a/ChangeLog b/ChangeLog index a4e960e71..2b612d60b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 1999-11-04 Alexandre Oliva + * tests/sh.test: New test to detect uses of quotes within + backticks within quotes. + * ltconfig.in, ltmain.in: Fix detected errors. Mark false + positives with a comment that disables the detector. + Reported by Akim Demaille + * configure.in: Move ltconfig and ltmain.sh generation back... * Makefile.am: here. diff --git a/ltconfig.in b/ltconfig.in index a9c23750c..33a2c624a 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -77,8 +77,11 @@ if test "X${echo_test_string+set}" != Xset; then done fi -if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || - test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' @@ -89,7 +92,8 @@ if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || for dir in $PATH /usr/ucb; do if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi @@ -99,7 +103,8 @@ if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && @@ -114,18 +119,23 @@ if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || # Try using printf. echo='printf "%s\n"' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : - elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + elif echo_testing_string=`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" - elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + elif echo_testing_string=`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... @@ -2447,10 +2457,10 @@ case "$ltmain" in postinstall_cmds | postuninstall_cmds | \ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. - eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ### testsuite: skip nested quoting test ;; *) - eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ### testsuite: skip nested quoting test ;; esac done diff --git a/ltmain.in b/ltmain.in index eee0954f3..f9406209d 100644 --- a/ltmain.in +++ b/ltmain.in @@ -2103,7 +2103,7 @@ EOF ;; file_magic*) set dummy $deplibs_check_method - file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`" + file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. @@ -2513,7 +2513,7 @@ EOF fi # Create the old-style object. - reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" eval cmds=\"$reload_cmds\" @@ -2674,13 +2674,13 @@ EOF exit 1 fi - new_lib_search_path="$new_lib_search_path `$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`" + new_lib_search_path="$new_lib_search_path `$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`" ### testsuite: skip nested quoting test deplibs="$deplibs $lib" for deplib in $dependency_libs; do case "$deplib" in -L*) - new_lib_search_path="$new_lib_search_path `$echo "X$deplib" | $Xsed -e 's/^-L//'`" + new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ### testsuite: skip nested quoting test ;; esac @@ -4013,7 +4013,7 @@ relink_command=\"$relink_command\"" esac fi - dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" @@ -4163,7 +4163,7 @@ relink_command=\"$relink_command\"" *) . ./$lib ;; esac fi - libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no diff --git a/tests/sh.test b/tests/sh.test index 370aad90d..41290b604 100755 --- a/tests/sh.test +++ b/tests/sh.test @@ -56,4 +56,11 @@ if egrep -n -e '\$Xsed' $scripts | egrep -v -n -e '\$echo \\*"X'; then status=1 fi +# Check for quotes within backquotes within quotes "`"bar"`" +if egrep -n -e '"[^`"]*`[^"`]*"[^"`]*".*`[^`"]*"' $scripts | \ + egrep -v "### testsuite: skip nested quoting test$"; then + echo "nested quotes are dangerous" + status=1 +fi + exit $status