On Wed, Oct 18, 2023, at 10:09 AM, KO Myung-Hun wrote: > Zack Weinberg wrote: >> Details please? > > Commit message was not enough ?
I'm afraid not. I needed to know everything you say in the next two paragraphs: > $ac_snip2 contains NL. And in order to print it, `print -r --' command > is used on mksh. > > BTW, printing without double-quoting, NL in $ac_snip2 is replaced with > a space. Because of this, M4 does not return contents expected. As a > result, test for $ac_snip2 fails. With this information I can understand your suggested change easily; without it I thought I might have to construct my own OS/2+mksh environment in order to figure out why this test was failing *only* in that environment. The reason this test is failing only in your environment, is because you generated the configure script *for Autoconf itself* with an older version of Autoconf. Current versions do not use `print -r` in the implementation of AS_ECHO. If you are building Autoconf from a git checkout, you should use the "bootstrap" script in the source directory to generate the configure script; if you are building from a release tarball you should use the configure script included in that tarball. Either of these should have masked the bug you found. Having said that, you *have* found a genuine bug. Autoconf's documentation is quite clear that the argument to AS_ECHO must be a "single shell word", in particular, not containing any unquoted whitespace (not just no newlines) after variable expansion. *Both* $ac_snippet and $ac_snip2 contain whitespace and therefore need to be quoted. It happens that replacing newlines with horizontal spaces breaks $ac_snip2 but not $ac_snippet, and it also happens that the `printf`-based implementation of AS_ECHO (which is used unconditionally by current Autoconf) mangles both in a different way that doesn't break either of them. But we should not be relying on either of these things. So I'm going to go ahead and commit your patch with quoting added to both $ac_snip2 and $ac_snippet. Final patch below. zw >From 88011e1f263fd7e794caa6e0984e623769d1c8c3 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun <kom...@gmail.com> Date: Wed, 18 Oct 2023 14:00:11 -0400 Subject: [PATCH] m4/m4.m4: Quote argument to AS_ECHO correctly. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AS_ECHO’s argument is required to be “a single shell word,” and this more precisely means it must not be altered by shell word splitting. In particular, if the argument contains shell variables whose values contain whitespace then it needs to be wrapped in "shell double quotes". The absence of these quotes caused one of the embedded M4 scripts to be mangled by the Autoconf 2.69 implementation of AS_ECHO. We don’t officially support bootstrapping with an older version of Autoconf (use the ./bootstrap script instead) but the absence of quotes is still incorrect. For consistency add [M4 quotes] to the use of AS_ECHO that was shell-quoted but not M4-quoted. * m4/m4.m4 (AC_PROG_GNU_M4): Quote argument to AS_ECHO correctly. --- m4/m4.m4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/m4/m4.m4 b/m4/m4.m4 index e6203118..919dbf4a 100644 --- a/m4/m4.m4 +++ b/m4/m4.m4 @@ -41,12 +41,12 @@ AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4 gnum4], ac_snip2=change'quote(<,>)def''ine(<T>,<>)d'nl ac_snip2=${ac_snip2}${as_nl}def'ine(<F>,<T(<traced>)>)d'nl ac_snip2=${ac_snip2}${as_nl}m4'wrap(<F>)d'nl - AS_ECHO("$as_me:${as_lineno-$LINENO}: trying $ac_path_M4") \ + AS_ECHO(["$as_me:${as_lineno-$LINENO}: trying $ac_path_M4"]) \ >&AS_MESSAGE_LOG_FD test -z "`$ac_path_M4 -F conftest.m4f </dev/null 2>&1`" \ - && test -z "`AS_ECHO([$ac_snippet]) | $ac_path_M4 --trace=mac 2>&1`" \ + && test -z "`AS_ECHO(["$ac_snippet"]) | $ac_path_M4 --trace=mac 2>&1`" \ && test -f conftest.m4f \ - && test x"`AS_ECHO([$ac_snip2]) | \ + && test x"`AS_ECHO(["$ac_snip2"]) | \ $ac_path_M4 --trace=T --debug=aflq 2>&1`" = \ x'm4trace:stdin:3: -1- T(<traced>)' \ && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=: -- 2.41.0