On 2026-05-30 02:14, Lasse Collin wrote:
It blocks C0 control chars but not C1.

Thanks for mentioning that. I suppose I vaguely hoped C1 wasn't a problem. Obviously I was mistaken.

I installed the attached to try to address this. This gives up on the USE_C_LOCALE business in quotearg.c which evidently can't work well for common platforms, and instead uses the less-ambitious _QUOTEARG_AVOID_UCHAR_H business that I just installed into Gnulib <https://lists.gnu.org/r/bug-gnulib/2026-05/msg00169.html>.
From e5293f9519b9d67c22a6baa3d7b0c31032a1ce2d Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sat, 30 May 2026 22:15:58 -0700
Subject: [PATCH 1/3] build: update gnulib submodule to latest

* configure.ac (_QUOTEARG_AVOID_UCHAR_H): New macro, replacing
USE_C_LOCALE; needed for latest Gnulib.
---
 configure.ac | 5 +++--
 gnulib       | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index f8ce122..09c5657 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,8 +30,9 @@ AM_INIT_AUTOMAKE([1.11 subdir-objects dist-xz dist-zip
                   color-tests parallel-tests])
 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
 
-dnl gzip does not use setlocale.
-AC_DEFINE([USE_C_LOCALE], [1], [Define to 1 if only the C locale is used.])
+dnl gzip avoids uchar-h.
+AC_DEFINE([_QUOTEARG_AVOID_UCHAR_H], [1],
+  [Define to 1 for quotearg to not use <uchar.h>.])
 
 dnl POSIXCHECK is worthwhile for maintainers, but adds several seconds
 dnl (more than 10% execution time) to ./configure, with no benefit for
diff --git a/gnulib b/gnulib
index d9723b1..2ec83b3 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit d9723b157578980c0c37782408a89e381393f032
+Subproject commit 2ec83b3ec468aeca379a6b4b0fda28444e1c6a43
-- 
2.53.0

From 77a211a25f70940bd26dfe815554a6dc4ab1810a Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sat, 30 May 2026 22:50:16 -0700
Subject: [PATCH 2/3] gzip: escape C1 controls when quoting
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Lasse Collin <https://bugs.gnu.org/81135#29>.
* gzip.c: Include <locale.h>.
(main): Start off with setlocale (LC_ALL, ""), so that multibyte
encodings work.  From the tryB suggestion of Bruno Haible
<https://bugs.gnu.org/81135#5> except it’s done even on native
MS-Windows.
---
 NEWS   | 13 +++++++++++++
 gzip.c |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/NEWS b/NEWS
index 55f381e..5b17e9d 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,12 @@ GNU gzip NEWS                                    -*- outline -*-
 
 ** Changes in behavior
 
+  gzip no longer insists on the "C" locale; instead, it follows the
+  typical practice of using the locale specified by the environment.
+  This change, which is needed for file name quoting, can affect the
+  format of floating-point numbers output by gzip's -l and -v options.
+  Diagnostics are still in English, though.
+
   gzip -l now reports "-Inf%" instead of "0.0%" for the infinite
   compression ratio of an empty file.
 
@@ -36,6 +42,13 @@ GNU gzip NEWS                                    -*- outline -*-
   only to improve performance, and its implementation had too many
   bugs to be worth supporting.
 
+** Platforms no longer supported
+
+  The following platforms (or earlier) are no longer supported because
+  their old multibyte libraries do not work well enough: FreeBSD 4.11
+  (2005), HP-UX 11.00 (1997), Minix 3.1.8 (2010), MS-Windows 8.1
+  (2013) via mingw without UCRT.
+
 
 * Noteworthy changes in release 1.14 (2025-04-09) [stable]
 
diff --git a/gzip.c b/gzip.c
index 302efe9..914247d 100644
--- a/gzip.c
+++ b/gzip.c
@@ -77,6 +77,7 @@ static char const license_msg[] =
 #include <getopt.h>
 #include <inttypes.h>
 #include <limits.h>
+#include <locale.h>
 #include <signal.h>
 #include <stdcountof.h>
 #include <stddef.h>
@@ -420,6 +421,8 @@ int main (int argc, char **argv)
     int env_argc;
     char **env_argv;
 
+    setlocale (LC_ALL, "");
+
     EXPAND(argc, argv); /* wild card expansion if necessary */
 
     program_name = gzip_base_name (argv[0]);
-- 
2.53.0

From a8fbba01dbedb07388c35f1732092845e0eae9aa Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sat, 30 May 2026 23:38:51 -0700
Subject: [PATCH 3/3] build: slim down wchar-h etc. configuration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since we don’t rely on Gnulib’s mbszero, uchar-h, wchar-h etc., we
can omit some configuration bureaucracy.
* bootstrap.conf (gnulib_tool_option_extras): Avoid mbszero too.
(bootstrap_post_import_hook): Remove m4/locale-en.m4, m4/wint_t.m4.
* configure.ac (gt_LOCALE_EN_UTF8, gt_TYPE_WINT_T)
(GNULIBHEADERS_OVERRIDE_WINT_T): Define dummies.
* lib/.gitignore, m4/.gitignore: Update.
---
 bootstrap.conf | 5 +++++
 configure.ac   | 5 +++++
 lib/.gitignore | 3 ---
 m4/.gitignore  | 7 -------
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index bfce470..9f69093 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -79,6 +79,7 @@ gnulib_tool_option_extras="\
  --avoid gnulib-i18n\
  --avoid mbrtoc32\
  --avoid mbsinit\
+ --avoid mbszero\
  --avoid threadlib\
  --avoid rpmatch\
  --avoid windows-once\
@@ -115,4 +116,8 @@ bootstrap_post_import_hook() {
 
   # Copy tests/init.sh from Gnulib.
   $gnulib_tool --copy-file tests/init.sh
+
+  # configure.ac defines dummies for gt_LOCALE_EN_UTF8, gt_TYPE_WINT_T.
+  rm m4/locale-en.m4
+  rm m4/wint_t.m4
 }
diff --git a/configure.ac b/configure.ac
index 09c5657..2fadc2d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,11 @@ dnl gzip avoids uchar-h.
 AC_DEFINE([_QUOTEARG_AVOID_UCHAR_H], [1],
   [Define to 1 for quotearg to not use <uchar.h>.])
 
+dnl gzip does not care about bugs detected by these macros.
+AC_DEFUN([gt_LOCALE_EN_UTF8])
+AC_DEFUN([gt_TYPE_WINT_T])
+GNULIBHEADERS_OVERRIDE_WINT_T=0
+
 dnl POSIXCHECK is worthwhile for maintainers, but adds several seconds
 dnl (more than 10% execution time) to ./configure, with no benefit for
 dnl most users.  Using it to look for bugs requires:
diff --git a/lib/.gitignore b/lib/.gitignore
index 3bd1063..4ffbdb0 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -124,7 +124,6 @@
 /malloc.c
 /malloca.c
 /malloca.h
-/mbszero.c
 /memchr.c
 /memchr.valgrind
 /memeq.c
@@ -230,8 +229,6 @@
 /utimens.h
 /verify.h
 /warn-on-use.h
-/wchar.h
-/wchar.in.h
 /xalloc-die.c
 /xalloc-oversized.h
 /xalloc.h
diff --git a/m4/.gitignore b/m4/.gitignore
index d1006a8..2bb8e73 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -65,17 +65,12 @@
 /largefile.m4
 /lib-ignore.m4
 /limits-h.m4
-/locale-en.m4
-/locale-ja.m4
-/locale-zh.m4
 /lseek.m4
 /lstat.m4
 /malloc.m4
 /malloca.m4
 /manywarnings-c++.m4
 /manywarnings.m4
-/mbrtowc.m4
-/mbstate_t.m4
 /memchr.m4
 /memeq.m4
 /mempcpy.m4
@@ -151,8 +146,6 @@
 /vararrays.m4
 /warn-on-use.m4
 /warnings.m4
-/wchar_h.m4
-/wint_t.m4
 /xalloc.m4
 /yesno.m4
 /zzgnulib.m4
-- 
2.53.0

Reply via email to