Hi Pádraig,

Regarding the 'od -j' quoting, I am leaning towards considering it as a
bug since coreutils-8.25 had the following news entry:

  All utilities now quote user supplied arguments in error strings,
  which avoids confusing error messages in the presence of '\r' chars etc.

What do you think? The other programs added listed in the proposed NEWS
entry in the attached patch are from this:

    $ git grep -l -E 'xstrtol_(error|fatal)' -- '*.[ch]' | \
        sed -E 's|^src/||; s|\.c$||' | sort -u
    df
    du
    ls
    od
    pr
    sort

I also only added a test for 'od -j', since it didn't seem very
beneficial to duplicate it for the other cases.

Collin

>From 086a91e5092987aed1a98cc3f1a966ac446f6803 Mon Sep 17 00:00:00 2001
Message-ID: <086a91e5092987aed1a98cc3f1a966ac446f6803.1781406237.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Sat, 13 Jun 2026 19:34:51 -0700
Subject: [PATCH] build: update gnulib submodule to latest

This imports a xstrtol-error change from Gnulib that fixes some error
messages that were not properly escaped when given an invalid integer
argument.

* .gitignore: Add /lib/thread-creators.h which is generated by Gnulib.
* gnulib: Update to the latest commit.
* tests/od/od.pl (@Tests): Add some test cases.
* NEWS: Mention the fix.
---
 .gitignore     | 1 +
 NEWS           | 4 ++++
 gnulib         | 2 +-
 tests/od/od.pl | 7 +++++++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index b6a576d56..ccf9b7911 100644
--- a/.gitignore
+++ b/.gitignore
@@ -120,6 +120,7 @@
 /lib/strings.h
 /lib/sys/
 /lib/termios.h
+/lib/thread-creators.h
 /lib/time.h
 /lib/uchar.h
 /lib/unicase.h
diff --git a/NEWS b/NEWS
index ac6a0d5ca..7e52ad71e 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ GNU coreutils NEWS                                    -*- outline -*-
   will correctly match the last delimiter specified.
   [bug introduced with multi-byte support in coreutils-9.11]
 
+  'df', 'du', 'ls', 'od', 'pr', and 'sort' no longer print some error messages
+  for invalid integer arguments without escaping.
+  [bug introduced in coreutils-8.25]
+
   'head' and 'tail' now quote names in file headers when needed.
   [This bug was present in "the beginning".]
 
diff --git a/gnulib b/gnulib
index e2fb3d721..0e4d6259e 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit e2fb3d721a7dc65bee6ddc887ccb0d1bdd7291e2
+Subproject commit 0e4d6259e06bb09c66d09062ff0b9662c5c380aa
diff --git a/tests/od/od.pl b/tests/od/od.pl
index b1dd46b03..b1aef42fc 100755
--- a/tests/od/od.pl
+++ b/tests/od/od.pl
@@ -100,6 +100,13 @@ my @Tests =
       {ERR=>"$prog: invalid -w argument '-1'\n"}],
      ['invalid-w-3',   '-ww -An', {IN=>""}, {EXIT=>1},
       {ERR=>"$prog: invalid -w argument 'w'\n"}],
+
+     # Check that xstrtol_fatal calls quote to escape command line arguments.
+     # In coreutils-9.11 # and earlier this was not the case.
+     ['bad-j-quote-1', "-j 'a\t'", {IN=>""}, {EXIT=>1},
+      {ERR=>"$prog: invalid -j argument 'a\\t'\n"}],
+     ['bad-j-quote-2', "-j '1\t'", {IN=>""}, {EXIT=>1},
+      {ERR=>"$prog: invalid suffix in -j argument '1\\t'\n"}],
     );
 
 push @Tests,
-- 
2.54.0

Reply via email to