]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* tests/sh.test: New test to detect uses of quotes within
authorAlexandre Oliva <oliva@lsd.ic.unicamp.br>
Thu, 4 Nov 1999 16:15:50 +0000 (16:15 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Thu, 4 Nov 1999 16:15:50 +0000 (16:15 +0000)
backticks within quotes.
* ltconfig.in, ltmain.in: Fix detected errors.  Mark false
positives with a comment that disables the detector.
Reported by Akim Demaille <akim@epita.fr>

ChangeLog
ltconfig.in
ltmain.in
tests/sh.test

index a4e960e71f3da59a2424c32311b82f378760ec78..2b612d60b1d6aa45d0eb5d898ab8ef5dd0a6cc10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 1999-11-04  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
 
+       * 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 <akim@epita.fr>
+
        * configure.in: Move ltconfig and ltmain.sh generation back...
        * Makefile.am: here.
        
index a9c23750c4da7137ee3d84757493ecd1cbff8577..33a2c624a59d368021ce1a20a4befd8fc1ac5a55 100755 (executable)
@@ -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
index eee0954f38efc22ce17264797625b8669c838d56..f9406209d6ddb6250376da5c6a875b88dad41f34 100644 (file)
--- 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
index 370aad90d9e2d3ff236b41c5aadf6195862642e6..41290b6043f30a8653c9a49514b1bbd19c44e228 100755 (executable)
@@ -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