[adding bug-gettext; this is a flaw in gettext, not m4. Two patches below; one for util-linux, one for gettext]
On 10/09/2014 02:14 PM, Eric Blake wrote: > On 10/09/2014 01:36 PM, Eric Blake wrote: > >> In particular, autom4te --verbose shows this is the runaway command line: >> >> /usr/bin/m4 --nesting-limit=1024 --gnu --include=/usr/share/autoconf >> --debug=aflq --fatal-warning --debugfile=/tmp/am4tSXlU7J/traces.0t >> --trace=AM_GNU_GETTEXT_VERSION --trace=_m4_warn --trace=include >> --trace=m4_include --trace=m4_pattern_allow --trace=m4_pattern_forbid >> --reload-state=/usr/share/autoconf/autoconf/autoconf.m4f >> --undefine=__m4_version__ - configure.ac > /tmp/am4tSXlU7J/output.0t > > and adding --debug to keep the temp files, I note that the traces.0t > file consistently gets stuck at: > > m4trace:configure.ac:506: -1- m4_pattern_allow([^LIBMOUNT_VERSION$]) > m4trace:configure.ac:519: -1- m4_pattern_allow([^HAVE_LIBMOUNT_MOUNT$]) > m4trace:configure.ac:546: -1- m4_pattern_allow([^H > > where configure.ac has at line 546: > > UTIL_CHECK_LIB(util, openpty) > > Alas, traces.0t is buffered, so it is not a precise point of where the > loop is happening, but somewhere shortly after there is the culprit. > I'm still trying to see if I can coax m4 into emitting more details > about what is looping; I may have luck attaching a gdb process at the > point it starts consuming memory... A bit more progress: if I inject: m4_builtin([m4exit], [33]) into key places in configure.ac, I can easily tell if the trace reaches that point. So I've narrowed it down to the macro call UTIL_CHECK_SYSCALL at line 745 of the configure.ac; the trace easily gets through everything earlier than that point, and never seems to get to anything after that point. So, the bug lies somewhere in the eternal expansion of this beast: UTIL_CHECK_SYSCALL([ioprio_set], [alpha], [442], [i*86], [289], [ia64*], [1274], [powerpc*], [273], [s390*], [282], [sparc*], [196], [sh*], [288], [x86_64*], [251]) And indeed, that calls an embedded _UTIL_CHECK_SYSCALL_FALLBACK(m4_shift($@)) which tries to recursively step through that list. Sadly, it recurses by way of m4_shiftn(2, $@), and _that_ macro calls m4_assert() as part of its means of ensuring that the recursion is sane. It is supposed to shift until empty. But gettext is rudely undefining m4_assert, which means the recursion is infinite because the next iteration is no longer empty, but contains an unexpanded instance of m4_assert. This patch to util-linux's configure.ac is sufficient to work around the gettext bug. ============ diff --git i/configure.ac w/configure.ac index c216045..df746ad 100644 --- i/configure.ac +++ w/configure.ac @@ -736,7 +736,9 @@ m4_define([_UTIL_CHECK_SYSCALL_FALLBACK], [m4_ifval([$1], [#( $1) syscall="$2" ;;dnl + m4_pushdef([m4_assert])dnl work around gettext 0.18 bug _UTIL_CHECK_SYSCALL_FALLBACK(m4_shiftn(2, $@))])dnl + m4_popdef([m4_assert])dnl ]) ============ Meanwhile, this is the patch I recommend for gettext; and since this is a build-breaker, I recommend that gettext push a new release soon (distros can backport the fix without waiting for the release; but the fact that the build system is BROKEN because of a flaw in gettext is a regression from 0.17 days). ============ diff --git i/gettext-tools/misc/autopoint.in w/gettext-tools/misc/autopoint.in index c31943f..87ee374 100644 --- i/gettext-tools/misc/autopoint.in +++ w/gettext-tools/misc/autopoint.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 2002-2013 Free Software Foundation, Inc. +# Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -143,14 +143,14 @@ fi func_trace_autoconf () { echo '\ -dnl disable macros which may abort autom4te -m4_undefine([m4_assert]) -m4_undefine([m4_fatal]) -m4_undefine([m4_warn]) -m4_undefine([m4_errprintn]) -m4_undefine([m4_exit]) -m4_undefine([m4_include]) -m4_undefine([m4_esyscmd]) +dnl replace macros which may abort autom4te with a no-op variant +m4_pushdef([m4_assert]) +m4_pushdef([m4_fatal]) +m4_pushdef([m4_warn]) +m4_pushdef([m4_errprintn]) +m4_pushdef([m4_exit]) +m4_pushdef([m4_include]) +m4_pushdef([m4_esyscmd]) ' \ | "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 \ --trace="$1":\$% - "$2" 2>/dev/null diff --git i/gettext-tools/misc/gettextize.in w/gettext-tools/misc/gettextize.in index dbe4d1e..33299b9 100644 --- i/gettext-tools/misc/gettextize.in +++ w/gettext-tools/misc/gettextize.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 1995-1998, 2000-2013 Free Software Foundation, Inc. +# Copyright (C) 1995-1998, 2000-2014 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -143,14 +143,14 @@ fi func_trace_autoconf () { echo '\ -dnl disable macros which may abort autom4te -m4_undefine([m4_assert]) -m4_undefine([m4_fatal]) -m4_undefine([m4_warn]) -m4_undefine([m4_errprintn]) -m4_undefine([m4_exit]) -m4_undefine([m4_include]) -m4_undefine([m4_esyscmd]) +dnl replace macros which may abort autom4te with a no-op variant +m4_pushdef([m4_assert]) +m4_pushdef([m4_fatal]) +m4_pushdef([m4_warn]) +m4_pushdef([m4_errprintn]) +m4_pushdef([m4_exit]) +m4_pushdef([m4_include]) +m4_pushdef([m4_esyscmd]) ' \ | "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 \ --trace="$1":\$% - "$2" 2>/dev/null ============ -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature