bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with --version after compiling autoconf


From: Eric Blake
Subject: Re: Problem with --version after compiling autoconf
Date: Wed, 30 May 2018 07:23:19 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]