autoconf-patches
[Top][All Lists]
Advanced

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

fix AT_SETUP's sh-escaping


From: Joel E. Denny
Subject: fix AT_SETUP's sh-escaping
Date: Thu, 10 Aug 2006 23:20:13 -0400 (EDT)

AT_SETUP does not properly sh-escape the value of its DESCRIPTION 
parameter.  If the value contains a single quote, sh may report a syntax 
error.  I could not find any escape sequence on the user's end to work 
around this case because AT_SETUP sometimes places the value between 
double quotes and sometimes between single quotes.

Below is a patch against Autoconf's lib/autotest/general.m4 revision 
1.214, which is currently the head.

Joel

--- general.m4_old      2006-07-09 11:55:03.000000000 -0400
+++ general.m4  2006-08-10 22:50:29.000000000 -0400
@@ -279,7 +279,7 @@
 # numerical order.
 at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [?])'
 # Description of all the test groups.
-at_help_all='AT_help_all'])])dnl
+at_help_all=AT_help_all])])dnl
 m4_divert_push([PARSE_ARGS])dnl
 
 at_prev=
@@ -1170,15 +1170,15 @@
 m4_ifdef([AT_capture_files], [m4_undefine([AT_capture_files])])
 m4_define([AT_line], AT_LINE)
 m4_define([AT_xfail], [at_xfail=no])
-m4_define([AT_description], [$1])
+m4_define([AT_description], [[$1]])
 m4_define([AT_ordinal], m4_incr(AT_ordinal))
 m4_append([AT_groups_all], [ ]m4_defn([AT_ordinal]))
 m4_divert_push([TESTS])dnl
   AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): $1
     at_setup_line='m4_defn([AT_line])'
-    at_desc='$1'
+    at_desc="AS_ESCAPE([$1])"
     $at_quiet $ECHO_N "m4_format([%3d: %-]m4_eval(47 - m4_qdelta([$1]))[s],
-                      AT_ordinal, [[$1]])[]$ECHO_C"
+                      AT_ordinal, m4_dquote(AS_ESCAPE([$1])))[]$ECHO_C"
 m4_divert_push([TEST_SCRIPT])dnl
 ])
 
@@ -1220,8 +1220,8 @@
 # Complete a group of related tests.
 m4_define([AT_CLEANUP],
 [m4_append([AT_help_all],
-m4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);m4_ifdef([AT_keywords],
 [m4_defn([AT_keywords])]);
-)dnl
+"AS_ESCAPE(m4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);m4_ifdef([AT_keywords],
 [m4_defn([AT_keywords])]);)
+")dnl
 m4_divert_pop([TEST_SCRIPT])dnl Back to TESTS
     AT_xfail
     echo "#                             -*- compilation -*-" >> "$at_group_log"




reply via email to

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