Re: Problem with --version after compiling autoconf

Eric Blake <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.general,gmane.comp.gnu.m4.bugs
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 05/30/2018 07:23 AM, Eric Blake wrote:

> 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]])

In fact, this used to work for single (but not multiple) letters; commit 
6e1d6e2c (added in 2.63, Oct 2007) changed from a manual comparison of 
the three contiguous regions of a-z in EBCDIC into using m4's 0r36:NNN 
notation:

-[m4_translit(m4_bpatsubsts(m4_tolower([[$1]]),
-                      [\([0-9]+\)\([abcdefghi]\)],
-                        [m4_eval(\1 + 1).-1.\2],
-                      [\([0-9]+\)\([jklmnopqrs]\)],
-                        [m4_eval(\1 + 1).-1.1\2],
-                      [\([0-9]+\)\([tuvwxyz]\)],
-                        [m4_eval(\1 + 1).-1.2\2]),
-        [abcdefghijklmnopqrstuvwxyz],
-        [12345678901234567890123456])])
+[m4_map_sep([m4_eval], [.], _$0([$1]))])
+m4_define([_m4_version_unletter],
+[m4_translit(m4_bpatsubst([[[$1]]], ]dnl
+m4_dquote(m4_dquote(m4_defn([m4_cr_Letters])))[[+],
+                   [+1.-1.[0r36:\&]]),

So you've found a 10-year-old bug in autoconf, and an even older bug in 
m4.  As least as far back as m4 commit bd11691d (Feb 2000, marked 
"Initial revision", which is when the current m4.git history starts), 
and the m4 1.4 release, m4's eval(0r36:NN) notation has been broken; 
more likely, all the way back to Nov 1993 when Francois Pinard 
introduced 0rNNN syntax into m4 1.1 (according to NEWS), although I 
cannot locate a tarball or version control of m4 that old.

It's worth patching m4 to not botch large-radix numbers on EBCDIC, but 
it's also possible to patch autoconf to quit relying on large-radix 
numbers; I'll probably end up patching both projects, when I get a chance.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

_______________________________________________
Autoconf mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/autoconf
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.