]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
m4sh: protect LINENO against stray macro
authorEric Blake <eblake@redhat.com>
Fri, 27 Aug 2010 16:59:40 +0000 (10:59 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 27 Aug 2010 16:59:40 +0000 (10:59 -0600)
* lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Double quote entire
sed script, to avoid issue uncovered by automake testsuite where
'b' was an m4 macro that broke execution on dash.
Reported by Stefano Lattarini.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
lib/m4sugar/m4sh.m4

index 236bfcdd036ef5ffc6e6b76039dddfb4c74e93d0..5a11ab3ba163cec5b762f18cd88cb25588478503 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-08-27  Eric Blake  <eblake@redhat.com>
 
+       m4sh: protect LINENO against stray macro
+       * lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Double quote entire
+       sed script, to avoid issue uncovered by automake testsuite where
+       'b' was an m4 macro that broke execution on dash.
+       Reported by Stefano Lattarini.
+
        m4sh: assume ${a:-b} support
        * tests/m4sh.at (Null variable substitution): New test.
        * doc/autoconf.texi (Shell Substitutions) <${var:-value}>: Mention
index 8343b25912a036cb8eb327acbc23422444f9616e..ef99cb5a0b523ef1611cb462e0a93c3633a81139 100644 (file)
@@ -1138,23 +1138,23 @@ dnl trailing '-' during substitution so that $LINENO is not a special
 dnl case at line end.  (Raja R Harinath suggested sed '=', and Paul
 dnl Eggert wrote the scripts with optimization help from Paolo Bonzini).
 [_AS_LINENO_WORKS || {
-  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+[  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
   sed -n '
     p
-    /[[$]]LINENO/=
+    /[$]LINENO/=
   ' <$as_myself |
     sed '
-      s/[[$]]LINENO.*/&-/
+      s/[$]LINENO.*/&-/
       t lineno
       b
       :lineno
       N
       :loop
-      s/[[$]]LINENO\([[^'$as_cr_alnum'_]].*\n\)\(.*\)/\2\1\2/
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
       t loop
       s/-\n.*//
     ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
+  chmod +x "$as_me.lineno"] ||
     AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell])
 
   # Don't try to exec as it changes $[0], causing all sort of problems