Re: Problem with --version after compiling autoconf

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.bugs,gmane.comp.sysutils.autoconf.general
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 05/30/2018 03:24 AM, Andy Armstrong wrote:
> Hi Eric,
> 
> 
> I ran 'make check' and got the following :
> 

> autom4te_perllibdir='..'/lib AUTOM4TE_CFG='../lib/autom4te.cfg'         ../bin/autom4te -B '..'/lib -B '..'/lib --language=autotest -I . -I . suite.at -o ./testsuite.tmp

The command looks reasonable,

> m4:local.at:18: bad expression in eval (bad input): ((?+1+0) > (2+0)) - ((?+1+0) < (2+0))
> autom4te: /workarea/tools/m4/bin/m4 failed with exit status: 1

but things are choking hard at:

m4_version_prereq([2.57])

which expands:

[m4_if(m4_version_compare(]m4_dquote(m4_defn([m4_PACKAGE_VERSION]))[, [$1]),
         [-1],
         [m4_default([$3],
                     [m4_fatal([Autoconf version $1 or higher is required],
                               [63])])],
         [$2])]


which in turn is expanding this macro before calling m4's eval with 
invalid input:

m4_bpatsubst(m4_bpatsubst(m4_translit([[[[0,$1]]]], [.-], [,,]),]dnl
m4_dquote(m4_dquote(m4_defn([m4_cr_Letters])))[[+],
               [+1,-1,[0r36:\&]]), [,0], [,[0r10:0]])

What are the contents of lib/m4sugar/version.m4?  But I suspect that 
part is fine.

Actually, I'm now quite certain that the m4_bpatsubst is not properly 
transliterating EBCDIC values into a base-36 number.  And in fact, 
looking at m4's source code, the problem is in m4 itself:

m4/src/eval.c:eval_lex()


       /* FIXME - this calculation can overflow.  Consider xstrtol.  */
       *val = 0;
       for (; *eval_text; eval_text++)
         {
           if (isdigit (to_uchar (*eval_text)))
             digit = *eval_text - '0';
           else if (islower (to_uchar (*eval_text)))
             digit = *eval_text - 'a' + 10;
           else if (isupper (to_uchar (*eval_text)))
             digit = *eval_text - 'A' + 10;

which means that anything larger than radix 20 (0-9 and a-j) is botched 
on an EBCDIC machine.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
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.