autoconf/lib/m4sugar
Zack Weinberg b7e32b4dc7
AS_ECHO(_N): Do not expand macros named ‘s’ or ‘n’ (#110377)
AS_ECHO expands to ‘printf "%s\n" $1’.  If a configure script defines
an M4 macro named ‘s’ or ‘n’ it will be expanded in the first argument
to printf, which is almost certainly not what was intended.
The configure script for ruby 2.7.2 uses ‘AS_VAR_PUSHDEF([s], ...)’
and breaks with 2.69d because of this.

Add some extra quoting so that the ‘%s\n’ is treated as literal;
similarly for AS_ECHO_N and the legacy shell variables $as_echo
and $as_echo_n.

For now, anyway, don’t quote the word ‘printf’; if someone does
define that as a M4 macro they might well mean to affect AS_ECHO.
(Whether this is something we *want* to allow, we can worry about
when it comes up.)

Fixes bug #110377.

* lib/m4sugar/m4sh.m4 (_AS_ECHO_N_PREPARE, AS_ECHO, AS_ECHO_N):
  Add another layer of quoting around the first argument to printf.
* tests/m4sh.at (Redefining AS_ECHO internals): New test.
2020-11-16 10:03:39 -05:00
..
foreach.m4 maint: make update-copyright 2020-01-01 11:45:50 -08:00
m4sh.m4 AS_ECHO(_N): Do not expand macros named ‘s’ or ‘n’ (#110377) 2020-11-16 10:03:39 -05:00
m4sugar.m4 Consistently expand macros in whitespace-separated lists. 2020-06-29 23:17:15 -07:00