[PATCH] autom4te: Handle m4 traces without file:line

Roman Bolshakov <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <[email protected]>
The symptoms are something like:

  Use of uninitialized value $msg in concatenation (.) or string
   at /usr/local/Cellar/autoconf/2.69/bin/autom4te line 1032.
  Use of uninitialized value $stacktrace in pattern match (m//)
   at /usr/local/Cellar/autoconf/2.69/bin/autom4te line 1032.
  unknown channel m4trace: -1- AS_VAR_APPEND(ac_configure_args, " '$ac_arg'")
   at /usr/local/Cellar/autoconf/2.69/share/autoconf/Autom4te/Channels.pm line 638.

The root cause is m4 traces without a file/line number shown.

So instead of something like:

   m4trace:configure.ac:48: -1- ...

you have something like:

  m4trace: -1- ...

The issue was first reported by Christophe de Dinechin as bug #25740:
  https://lists.gnu.org/archive/html/bug-automake/2017-02/msg00002.html

He then provided two variants of the fixes in the thread:
  https://lists.gnu.org/archive/html/bug-automake/2017-03/msg00003.html

The first fix skips errors that can't be handled by autom4te.
The second one sets file and line number to placeholders.
This is a resend of the second fix.

Signed-off-by: Christophe de Dinechin <[email protected]>
Signed-off-by: Roman Bolshakov <[email protected]>
---
 bin/autom4te.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/autom4te.in b/bin/autom4te.in
index abe6327d..de4d96b4 100644
--- a/bin/autom4te.in
+++ b/bin/autom4te.in
@@ -829,6 +829,9 @@ EOF
       # Traces without arguments, always on a single line.
       s{^m4trace:(.+):(\d+): -(\d+)- ([^)]*)\n$}
        {AT_$4([$1], [$2], [$3], [$4])\n};
+      # Traces without file and line number.
+      s{^m4trace: -(\d+)- ([^(]+)\((.*)$}
+       {AT_$2([nowhere], [0], [$1], [$2], $3};
       print $trace_m4 "$_";
     }
   $trace_m4->close;
-- 
2.19.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.