diff options
author | Eric Blake <eblake@redhat.com> | 2023-01-13 15:32:15 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2023-01-13 15:41:14 -0600 |
commit | dd434e3e958b3cebde954d66010919a40665812e (patch) | |
tree | c92c0b8b38d201b7bce9e6a3751b605a6b23a1b2 | |
parent | 3943e7355e4749ea53a8a5319a43926723c56a39 (diff) | |
download | m4-dd434e3e958b3cebde954d66010919a40665812e.tar.gz |
format: force C locale on floating point
A minor release is not the time for format(`%.1f', `4.0') to complain
about 4.0 not being a number followed by outputting "4,0" in locales
where the decimal point is a comma. Such a change belongs better in a
major release where more thought is put into locale-awareness across
the board.
* src/m4.c (main): Force LC_NUMERIC to c.
Reported-by: Bruno Haible in
https://lists.gnu.org/r/bug-m4/2021-06/msg00021.html
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | src/m4.c | 4 |
2 files changed, 11 insertions, 0 deletions
@@ -9,6 +9,13 @@ GNU M4 NEWS - User visible changes. `debugmode(t)') could read invalid memory when tracing a series of pushed macros that are popped during argument collection. +** Fix regression introduced in 1.4.19 where the `format' builtin + inadvertently took on locale-dependent parsing and output of floating + point numbers as a side-effect of introducing message translations. + While it would be nice for m4 to be fully locale-aware, such a behavior + change belongs in a major version release such as 1.6, and not a minor + release. + * Noteworthy changes in release 1.4.19 (2021-05-28) [stable] ** A number of portability improvements inherited from gnulib, including @@ -419,6 +419,10 @@ main (int argc, char *const *argv) set_program_name (argv[0]); retcode = EXIT_SUCCESS; setlocale (LC_ALL, ""); + /* m4 1.4.x does not want locale-aware decimal separators in the + format builtin; easiest is to override the user's choice of + LC_NUMERIC. */ + setlocale (LC_NUMERIC, "C"); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); atexit (close_stdin); |