libtool-commit
[Top][All Lists]
Advanced

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

[SCM] GNU Libtool branch, master, updated. v2.4.2-278-g5962e9a


From: Gary V. Vaughan
Subject: [SCM] GNU Libtool branch, master, updated. v2.4.2-278-g5962e9a
Date: Sat, 06 Oct 2012 08:11:39 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Libtool".

The branch, master has been updated
       via  5962e9ab32b54d37d5cece3dea56cdd3fcf1f914 (commit)
      from  b505244be8b5160a5564fd3fd1daf16a0038415b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5962e9ab32b54d37d5cece3dea56cdd3fcf1f914
Author: Gary V. Vaughan <address@hidden>
Date:   Sat Oct 6 15:01:52 2012 +0700

    tests: sanitise the libtool quote checking Autotests.
    
    Carefully comment the maze of quoting and escaping needed to
    pass through M4, $SHELL, and grep before regexp matching.
    * tests/libtool.at (quote shell meta-characters in filenames):
    Split backslash into a separate test group, because it needs
    additional escaping.
    Use grep consistently for the entire test group.
    Use AT_CHECK rather than LT_AT_CHECK to avoid problems with
    escaping literal $ correctly with LT_ESCAPE.
    Use the correct number of backslashes for each sub-group.
    Escape double-quote literals portably.
    Reported by Peter Rosin.
    
    Signed-off-by: Gary V. Vaughan <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 tests/libtool.at |   44 +++++++++++++++++++++++++++++++-------------
 1 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/tests/libtool.at b/tests/libtool.at
index fafec37..4ab405c 100755
--- a/tests/libtool.at
+++ b/tests/libtool.at
@@ -95,35 +95,53 @@ for mode in compile link install; do
     ;;
   esac
 
-  # Trivial.
-  LT_AT_CHECK([$LIBTOOL -n --mode=$mode $preargs $preflag"$flag:test" 
$postargs],
+
+  # Trivial...
+
+  AT_CHECK([$LIBTOOL -n --mode=$mode $preargs $preflag"$flag:test" $postargs],
           [0], [stdout])
   # We must not attempt to match $preargs in the output, because libtool
   # may modify them.  For example, on Cygwin, ``libtool --mode=link gcc -o
   # foo foo.o''  becomes ``gcc -o foo.exe foo.o''.
-  LT_AT_CHECK([$EGREP "$mode:.*$match_preflag$flag:test " stdout], [0], 
[ignore])
+  AT_CHECK([grep "$mode:.*$match_preflag$flag:test " stdout], [0], [ignore])
+
 
-  # Metacharacters that should be backslashified.
-  for mchar in \" \` \$ \\; do
-    LT_AT_CHECK([$LIBTOOL -n --mode=$mode $preargs 
$preflag"$flag$mchar:test$mchar" $postargs],
+  # Non-trivial...
+
+  # Backslash needs to be double-escaped: one escape is stripped as the shell
+  # collects arguments for grep (\\\\\\\\ => \\\\), and then another escape
+  # is stripped by grep itself (\\\\ => \\) before the resulting expression is
+  # matched (grepping for \\ matches \):
+  AT_CHECK([$LIBTOOL -n --mode=$mode $preargs $preflag"$flag\\:test\\" 
$postargs],
+          [0], [stdout])
+  # NOTE: we use "..."'"'"..." to insert a literal quote into the expression
+  #       because "...\"..." is not expanded consistently by all shells.
+  AT_CHECK([grep "$mode:.*$match_preflag"'"\?'"$flag\\\\\\\\:test\\\\\\\\"'"\? 
' stdout],
+             [0], [ignore])
+
+  # Shell metacharacters that should be backslashified by libtool.
+  for mchar in \" \` \$; do
+    AT_CHECK([$LIBTOOL -n --mode=$mode $preargs 
$preflag"$flag$mchar:test$mchar" $postargs],
             [0], [stdout])
-    LT_AT_CHECK([$EGREP 
"$mode:.*$match_preflag\"?$flag\\\\\\$mchar:test\\\\\\$mchar\"? " stdout], [0], 
[ignore])
+    AT_CHECK([grep 
"$mode:.*$match_preflag"'"'"\?$flag\\\\$mchar:test\\\\$mchar"'"'"\? " stdout], 
[0], [ignore])
   done
 
-  # Metacharacters that should be double quoted, and need escaping for grep
+  # Shell metacharacters that should be double quoted by libtool, and need
+  # backslash escaping for input to grep.
   for mchar in "@<:@" "@:>@" "^" "*"; do
 
-    LT_AT_CHECK([$LIBTOOL -n --mode=$mode $preargs 
$preflag"$flag$mchar:test$mchar" $postargs],
+    AT_CHECK([$LIBTOOL -n --mode=$mode $preargs 
$preflag"$flag$mchar:test$mchar" $postargs],
             [0], [stdout])
-    LT_AT_CHECK([grep "$mode:.*$match_preflag\"$flag\\$mchar:test\\$mchar\" " 
stdout], [0], [ignore])
+    AT_CHECK([grep "$mode:.*$match_preflag\"$flag\\$mchar:test\\$mchar\" " 
stdout], [0], [ignore])
   done
 
-  # Metacharacters that should be double quoted, that are not special to grep.
+  # Metacharacters that should be double quoted by libtool, but which are
+  # not special to grep (NOTE: Some of these ARE special to $EGREP!!).
   for mchar in "~" "#" "&" "(" ")" "{" "}" "|" ";" "<" ">" "?" "'" " " "       
"; do
 
-    LT_AT_CHECK([$LIBTOOL -n --mode=$mode $preargs 
$preflag"$flag$mchar:test$mchar" $postargs],
+    AT_CHECK([$LIBTOOL -n --mode=$mode $preargs 
$preflag"$flag$mchar:test$mchar" $postargs],
             [0], [stdout])
-    LT_AT_CHECK([grep "$mode:.*$match_preflag\"$flag$mchar:test$mchar\" " 
stdout], [0], [ignore])
+    AT_CHECK([grep "$mode:.*$match_preflag\"$flag$mchar:test$mchar\" " 
stdout], [0], [ignore])
   done
 done
 


hooks/post-receive
-- 
GNU Libtool



reply via email to

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