Re: incomplete warning message
On 09/20/2010 02:14 PM, Eric Blake wrote: However, my perl is rather weak, so I'm not sure if I can quickly correct it. Help would be appreciated. Hmm, reading lib/Autom4te/Channels.pm is proving to be enlightening: Maybe the solution is just to teach autom4te that warning outputs consist of partial messages. Does this look sane? Since my perl is weak, are there any suggestions on more robust ways to express this action? I'm also working on a testsuite addition, to make sure we don't regress in the future. diff --git i/ChangeLog w/ChangeLog index 458343f..c2ae56b 100644 --- i/ChangeLog +++ w/ChangeLog @@ -1,3 +1,10 @@ +2010-09-20 Eric Blake ebl...@redhat.com + + autom4te: don't filter out portions of location traces + * bin/autom4te.in (_m4_warn): Pass warnings through the channels + machinery as a single chunk, to avoid partial filtering. + Reported by Bruno Haible. + 2010-09-17 Eric Blake ebl...@redhat.com build: support autobuild diff --git i/bin/autom4te.in w/bin/autom4te.in index e1d40e3..e7afb6c 100644 --- i/bin/autom4te.in +++ w/bin/autom4te.in @@ -1022,11 +1022,11 @@ for (split (/\n*$separator\n*/o, contents ($tmp/warnings))) # | input.as:3: foo is expanded from... # | input.as:5: the top level my ($cat, $loc, $msg, $stacktrace) = split ('::', $_, 4); - msg $cat, $loc, warning: $msg; + msg $cat, $loc, warning: $msg, partial = ($stacktrace =~ /top level/) + 0; for (split /\n/, $stacktrace) { my ($loc, $trace) = split (': ', $_, 2); - msg $cat, $loc, $trace; + msg $cat, $loc, $trace, partial = ($trace !~ /top level/) + 0; } } -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org
Re: incomplete warning message
On 09/20/2010 02:59 PM, Ralf Wildenhues wrote: Since my perl is weak, are there any suggestions on more robust ways to express this action? Searching for newlines in the first regex? You want it to be partial exactly if you print more lines. It would be easier if I could print an empty warning as the non-partial line, as in (pseudo-code): msg $cat, $loc, warning: msg, partial = 1; for (split /\n/, $stacktrace) { msg $cat, $loc, $trace, partial = 1; } msg $cat, :0, ; rather than having to determine on the fly whether $stacktrace is non-empty, and if so, which $trace of $stacktrace is the last line. Is that something that Channels.pm already supports, or which could be added easily? I'm also working on a testsuite addition, to make sure we don't regress in the future. You should try to test both one-line and multi-line messages. Agreed, and this does it. It covers one-line messages when m4_warn is called at the top-level, and multi-line messages when m4_warn is called inside an m4_defun'd macro; this test fails without the autom4te.in patch shown earlier (the line script.4s:2: cross_warning is expanded from... was eaten), but passes with my first round of the patch: diff --git a/tests/m4sugar.at b/tests/m4sugar.at index 900bc3b..f5182dc 100644 --- a/tests/m4sugar.at +++ b/tests/m4sugar.at @@ -245,15 +245,14 @@ AT_CLEANUP AT_SETUP([m4@t...@_warn]) -# FIXME: For the time being we use -f to make sure we do issue the -# warnings. But maybe autom4te should handle that by itself? - AT_DATA_M4SUGAR([script.4s], [[m4_init -m4_defun([cross_warning], [m4_warn([cross], [cross])]) +m4_defun([cross_warning], [m4_warn([cross], [cross])]) m4_divert([0])dnl -m4_warn([obsolete], [obsolete])dnl +m4_warn([obsolete], [obsolete])dnl +cross_warning[]dnl +m4_warn([syntax], [syntax])dnl cross_warning[]dnl m4_warn([syntax], [syntax])dnl ]]) @@ -261,27 +260,38 @@ m4_warn([syntax], [syntax])dnl AT_CHECK_M4SUGAR([-o-], 0, [], [script.4s:4: warning: prefer named diversions script.4s:7: warning: syntax +script.4s:9: warning: syntax ]) -AT_CHECK_M4SUGAR([-o- -Wall -f], 0, [], +AT_CHECK_M4SUGAR([-o- -Wall], 0, [], [script.4s:4: warning: prefer named diversions script.4s:5: warning: obsolete script.4s:6: warning: cross script.4s:2: cross_warning is expanded from... script.4s:6: the top level script.4s:7: warning: syntax +script.4s:8: warning: cross +script.4s:2: cross_warning is expanded from... +script.4s:8: the top level +script.4s:9: warning: syntax ]) -AT_CHECK_M4SUGAR([-o- -Wnone,cross -f], 0, [], +AT_CHECK_M4SUGAR([-o- -Wnone,cross], 0, [], [script.4s:6: warning: cross script.4s:2: cross_warning is expanded from... script.4s:6: the top level +script.4s:8: warning: cross +script.4s:2: cross_warning is expanded from... +script.4s:8: the top level ]) -AT_CHECK_M4SUGAR([-o- -Wnone,cross,error -f], 1, [], +AT_CHECK_M4SUGAR([-o- -Wnone,cross,error], 1, [], [[script.4s:6: warning: cross script.4s:2: cross_warning is expanded from... script.4s:6: the top level +script.4s:8: warning: cross +script.4s:2: cross_warning is expanded from... +script.4s:8: the top level ]]) AT_CLEANUP -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org
Re: incomplete warning message
Hi Eric, * Eric Blake wrote on Mon, Sep 20, 2010 at 10:36:00PM CEST: On 09/20/2010 02:14 PM, Eric Blake wrote: Hmm, reading lib/Autom4te/Channels.pm is proving to be enlightening: Maybe the solution is just to teach autom4te that warning outputs consist of partial messages. Does this look sane? Yes, that looks sane, thanks. Remember that each `partial = 1' message must be finished by a non-partial part, otherwise it may not be seen. Since my perl is weak, are there any suggestions on more robust ways to express this action? Searching for newlines in the first regex? You want it to be partial exactly if you print more lines. I'm also working on a testsuite addition, to make sure we don't regress in the future. You should try to test both one-line and multi-line messages. Gee, I vaguely remember having a similar patch in my tree somewhere, but I can't find it now. Cheers, Ralf + autom4te: don't filter out portions of location traces + * bin/autom4te.in (_m4_warn): Pass warnings through the channels + machinery as a single chunk, to avoid partial filtering. + Reported by Bruno Haible. --- i/bin/autom4te.in +++ w/bin/autom4te.in @@ -1022,11 +1022,11 @@ for (split (/\n*$separator\n*/o, contents ($tmp/warnings))) # | input.as:3: foo is expanded from... # | input.as:5: the top level my ($cat, $loc, $msg, $stacktrace) = split ('::', $_, 4); - msg $cat, $loc, warning: $msg; + msg $cat, $loc, warning: $msg, partial = ($stacktrace =~ /top level/) + 0; for (split /\n/, $stacktrace) { my ($loc, $trace) = split (': ', $_, 2); - msg $cat, $loc, $trace; + msg $cat, $loc, $trace, partial = ($trace !~ /top level/) + 0; } }
Re: incomplete warning message
On 08/30/2010 01:50 PM, Eric Blake wrote: $ autoconf configure.ac:63: warning: gl_LIBUNISTRING_LIBSOURCE was called before gl_LIBUNISTRING m4/libunistring-base.m4:21: gl_LIBUNISTRING_LIBSOURCE is expanded from... m4/gnulib-comp.m4:148: gl_INIT is expanded from... configure.ac:63: the top level configure.ac:63: warning: gl_LIBUNISTRING_LIBHEADER was called before gl_LIBUNISTRING m4/libunistring-base.m4:53: gl_LIBUNISTRING_LIBHEADER is expanded from... The last line looks like the stack trace would include at least one more line. But it ends abruptly. I'm wondering if somehow the mere act of printing the backtrace is deleting the stacktrace. I think this one should be easy enough to track down before 2.68, so I'm reviving it on my list of hot TODO items this week. The backtrace produced by m4 is just fine. For proof, look at autom4te.cache/traces.n (for the appropriate n). I think what is happening is that autom4te is then passing these messages on through perl, and perl is doing some sort of internal caching about whether a particular warning line has already been printed, in which case it omits the second printout. Since autom4te is handling each location line as a separate warning, rather than passing the entire warning, location stack and all, as a single entity, this means that all duplicated location lines are getting squelched at the perl layer. How to reproduce: $ wget http://www.haible.de/bruno/gnu/autoconf-bug-20100531.tar.gz $ tar xvfz autoconf-bug-20100531.tar.gz $ cd autoconf-bug-20100531 $ autoconf I saw it as well last week when cleaning up some gnulib AC_COMPILE_IFELSE usage patterns. This is the area of autom4te that is introducing the problem: handle_traces ($req, $tmp/warnings, ('_m4_warn' = \$1::\$f:\$l::\$2::\$3$separator)); # Swallow excessive newlines. for (split (/\n*$separator\n*/o, contents ($tmp/warnings))) { # The message looks like: # | syntax::input.as:5::ouch # | ::input.as:4: baz is expanded from... # | input.as:2: bar is expanded from... # | input.as:3: foo is expanded from... # | input.as:5: the top level my ($cat, $loc, $msg, $stacktrace) = split ('::', $_, 4); msg $cat, $loc, warning: $msg; for (split /\n/, $stacktrace) { my ($loc, $trace) = split (': ', $_, 2); msg $cat, $loc, $trace; } } However, my perl is rather weak, so I'm not sure if I can quickly correct it. Help would be appreciated. Hmm, reading lib/Autom4te/Channels.pm is proving to be enlightening: =item Cpartial =Egt 0 When set, indicates a partial message that should be output along with the next message with Cpartial unset. Several partial messages can be stacked this way. Duplicate filtering will apply to the Iglobal message resulting from all Ipartial messages, using the options from the last (non-partial) message. Linking associated messages is the main reason to use this option. For instance the following messages msg 'channel', 'foo:2', 'redefinition of A ...'; msg 'channel', 'foo:1', '... A previously defined here'; msg 'channel', 'foo:3', 'redefinition of A ...'; msg 'channel', 'foo:1', '... A previously defined here'; will result in foo:2: redefinition of A ... foo:1: ... A previously defined here foo:3: redefinition of A ... where the duplicate I... A previously defined here has been filtered out. Linking these messages using Cpartial as follows will prevent the fourth message to disappear. msg 'channel', 'foo:2', 'redefinition of A ...', partial = 1; msg 'channel', 'foo:1', '... A previously defined here'; msg 'channel', 'foo:3', 'redefinition of A ...', partial = 1; msg 'channel', 'foo:1', '... A previously defined here'; Note that because the stack of Cpartial messages is printed with the first non-Cpartial message, most options of Cpartial messages will be ignored. Maybe the solution is just to teach autom4te that warning outputs consist of partial messages. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org
Re: incomplete warning message
On 09/20/2010 02:59 PM, Ralf Wildenhues wrote: Yes, that looks sane, thanks. Remember that each `partial = 1' message must be finished by a non-partial part, otherwise it may not be seen. Since my perl is weak, are there any suggestions on more robust ways to express this action? Searching for newlines in the first regex? You want it to be partial exactly if you print more lines. After staring at it some more, and running my testsuite addition, I'm confident my solution is correct. In m4sugar.m4, m4_warn is defined as giving a third argument to _m4_warn that will either be empty, or be the expansion of m4_expansion_stack, which always ends with the top level. Yes, it means that m4sugar.m4 and autom4te.in are tied rather closely together, but I'm happy enough with the fix that I'm going ahead and pushing it. We can optimize things later, such as making Channels.pm friendlier for ending a batch of partial messages without having to decide within a split whether a particular line is the last part of the message. But that can be after 2.68. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org
Re: incomplete warning message
* Eric Blake wrote on Mon, Sep 20, 2010 at 11:10:14PM CEST: On 09/20/2010 02:59 PM, Ralf Wildenhues wrote: Since my perl is weak, are there any suggestions on more robust ways to express this action? Searching for newlines in the first regex? You want it to be partial exactly if you print more lines. It would be easier if I could print an empty warning as the non-partial line, as in (pseudo-code): msg $cat, $loc, warning: msg, partial = 1; for (split /\n/, $stacktrace) { msg $cat, $loc, $trace, partial = 1; } msg $cat, :0, ; rather than having to determine on the fly whether $stacktrace is non-empty, and if so, which $trace of $stacktrace is the last line. Is that something that Channels.pm already supports, or which could be added easily? Looking at the code, it should be supported already. Untested though, and I think the location should be an empty string. Cheers, Ralf
Re: incomplete warning message
On 05/31/2010 03:15 PM, Bruno Haible wrote: Hi, Here's a case of an incomplete invocation stack trace in an autoconf warning: $ autoconf configure.ac:63: warning: gl_LIBUNISTRING_LIBSOURCE was called before gl_LIBUNISTRING m4/libunistring-base.m4:21: gl_LIBUNISTRING_LIBSOURCE is expanded from... m4/gnulib-comp.m4:148: gl_INIT is expanded from... configure.ac:63: the top level configure.ac:63: warning: gl_LIBUNISTRING_LIBHEADER was called before gl_LIBUNISTRING m4/libunistring-base.m4:53: gl_LIBUNISTRING_LIBHEADER is expanded from... The last line looks like the stack trace would include at least one more line. But it ends abruptly. I'm wondering if somehow the mere act of printing the backtrace is deleting the stacktrace. I think this one should be easy enough to track down before 2.68, so I'm reviving it on my list of hot TODO items this week. How to reproduce: $ wget http://www.haible.de/bruno/gnu/autoconf-bug-20100531.tar.gz $ tar xvfz autoconf-bug-20100531.tar.gz $ cd autoconf-bug-20100531 $ autoconf I saw it as well last week when cleaning up some gnulib AC_COMPILE_IFELSE usage patterns. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org