diff --git a/coreutils-9.5.tar.xz b/coreutils-9.5.tar.xz
deleted file mode 100644
index 63773fa..0000000
--- a/coreutils-9.5.tar.xz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:cd328edeac92f6a665de9f323c93b712af1858bc2e0d88f3f7100469470a1b8a
-size 6007136
diff --git a/coreutils-9.5.tar.xz.sig b/coreutils-9.5.tar.xz.sig
deleted file mode 100644
index 6607e1a..0000000
--- a/coreutils-9.5.tar.xz.sig
+++ /dev/null
@@ -1,16 +0,0 @@
------BEGIN PGP SIGNATURE-----
-
-iQIzBAABCAAdFiEEbDfcEhIaUAa8HbgE32/ZcTBgN9kFAmYFirgACgkQ32/ZcTBg
-N9nZMg//WF6fyy6kxNZJIeUnAzAyMhY5hjlD33hFSaj2ihfmt7IQzRuOu7bhYk94
-5lpDJvfljubJpuAU15MD0g/7xdRVPEf/igkRqdvm79eWips1c8d7HfcorxqJcYKf
-40JV0rQyDaMqQbqFl6rPipAaagE3GBSdHz3eNVhiEQ9MII/XKNX7dZ/5MBIUW/wl
-VM7G7sA4WBh0k+K0fGNALrlFHSmQDqwVIVhuDlFNcVmY37NIsIcvIT910HlKTFWV
-A5okdepRs9a2dOIhGvMVK/U+4D9vbVbS+QlnXH74UlmnczKPQsCQKsusG02bv9L0
-ih+jFj9BVCoUjB1fQlo6/VE4Kvdhpg/NZKZCaKIEH0d4mn1XHqvyTTRN0SVOlJr8
-ZmY7e94A5TDbpkt5MFPxZ6M1Z5dZTtVX2/rkQtb59jIr/p5eYmjId3NsjWtoXICo
-XMr+hLtjMt/XIfN/eXnaSOZSoyNxOPurfe59hfjVhaexCeIrEIglZmYWw8HhkfWz
-vAxGWOFVwYfWlWlfxggdYkysRvU0vUb1JhO8HIRwmCX05YEhvTwKZMnvo/z/Y++G
-CrXyduj9e8jzRkunlU6mqFmHqaYrgt5t7e1PLFYxEgWBX77fvpSbBsLhX5nH2c6I
-4uRaQpaZQ+hnYu7U5OHfhy1OwG2qcYjbou4zK4BuI1ktnBHFgbc=
-=IhBg
------END PGP SIGNATURE-----
diff --git a/coreutils-9.8-tail-large-num-of-files.patch b/coreutils-9.8-tail-large-num-of-files.patch
new file mode 100644
index 0000000..47c5a90
--- /dev/null
+++ b/coreutils-9.8-tail-large-num-of-files.patch
@@ -0,0 +1,82 @@
+Upstream patch on top of v9.8 for 'tail -nN' for larger N.
+Remove for next release >v9.8 again.
+Tracked at Fedora as: rh#2398008
+
+Upstream patch:
+https://cgit.git.sv.gnu.org/cgit/coreutils.git/commit/?id=914972e80dbf82aac9ffe3
+
+ tail: fix tailing larger number of lines in regular files
+
+ * src/tail.c (file_lines): Seek to the previous block instead of the
+ beginning (or a little before) of the block that was just scanned.
+ Otherwise, the same block is read and scanned (at least partially)
+ again. This bug was introduced by commit v9.7-219-g976f8abc1.
+ * tests/tail/basic-seek.sh: Add a new test.
+ * tests/local.mk: Reference the new test.
+ * NEWS: mention the bug fix.
+
+Applied downstream/here without the NEWS entry:
+
+ 'tail' outputs the correct number of lines again for non-small -n values.
+ Previously it may have output too few lines.
+ [bug introduced in coreutils-9.8]
+
+
+Index: src/tail.c
+===================================================================
+--- src/tail.c.orig
++++ src/tail.c
+@@ -596,7 +596,7 @@ file_lines (char const *prettyname, int
+ goto free_buffer;
+ }
+
+- pos = xlseek (fd, -bufsize, SEEK_CUR, prettyname);
++ pos = xlseek (fd, -(bufsize + bytes_read), SEEK_CUR, prettyname);
+ bytes_read = read (fd, buffer, bufsize);
+ if (bytes_read < 0)
+ {
+Index: tests/local.mk
+===================================================================
+--- tests/local.mk.orig
++++ tests/local.mk
+@@ -179,6 +179,7 @@ all_tests = \
+ tests/tty/tty-eof.pl \
+ tests/misc/read-errors.sh \
+ tests/misc/write-errors.sh \
++ tests/tail/basic-seek.sh \
+ tests/tail/inotify-hash-abuse.sh \
+ tests/tail/inotify-hash-abuse2.sh \
+ tests/tail/F-vs-missing.sh \
+Index: tests/tail/basic-seek.sh
+===================================================================
+--- /dev/null
++++ tests/tail/basic-seek.sh
+@@ -0,0 +1,28 @@
++#!/bin/sh
++# Verify that tail works when seeking within a file
++
++# Copyright (C) 2025 Free Software Foundation, Inc.
++
++# This program is free software: you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation, either version 3 of the License, or
++# (at your option) any later version.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++print_ver_ tail
++
++yes '=================================' |
++ head -n1K > file.in || framework_failure_
++
++# This returned 139 in coreutils v9.8
++test $(tail -n200 file.in | wc -l) = 200 || fail=1
++
++Exit $fail
diff --git a/coreutils-9.8.tar.xz b/coreutils-9.8.tar.xz
new file mode 100644
index 0000000..483f7e8
--- /dev/null
+++ b/coreutils-9.8.tar.xz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e6d4fd2d852c9141a1c2a18a13d146a0cd7e45195f72293a4e4c044ec6ccca15
+size 6234824
diff --git a/coreutils-9.8.tar.xz.sig b/coreutils-9.8.tar.xz.sig
new file mode 100644
index 0000000..1ea9e61
--- /dev/null
+++ b/coreutils-9.8.tar.xz.sig
@@ -0,0 +1,16 @@
+-----BEGIN PGP SIGNATURE-----
+
+iQIzBAABCgAdFiEEbDfcEhIaUAa8HbgE32/ZcTBgN9kFAmjRjKgACgkQ32/ZcTBg
+N9m2URAArTex5vWuCBnU0BT+T5/eu19+ePhbdaDBvhSap5SBbR+wL0jQphuApGLX
+LbMRnDw31C+KtTjcHHVChf4T1LMx8IrFuIcAO3eIOGaLiCw5is/U0FIarr/+81yV
+dZEdI53JS8M6e81tjcmfDjIa6A7Gz6+9V3+eF06LRWUDJfHKzOcUnIBVnJEzFRz1
+M9U4c6VVEOfcAFD4rCfd3g01nKZwFgCyeIAqn6ldFkSX6xuGQowAnF4VrnfgZMcG
+sxX/GyIMPRxBxzjDFNUhvCXBUSFQ/Y0I0GTlH7RQFNPVUSM7Vw3qUPShU4nsL++I
+9Ewjw27W7fgOjmAV2KOz/uxCpYnW6COyiw/3x3+QLnrIhyXvh/yXnhghyb2s9bQm
+U9A2qRcqsLE3aML9lKovvStb3dC3iz/+g/expeikIEzLwxHrwagkpv22Kpu4dBbN
+qZtw4XO0ffnVcyzF1DE3Aa2kQ30OqKmSWKCXHk5Zd9LeqaagPcDlt1sNHPxquDLn
+QZMyuKlDLwIMm5D2GMqdz8JZcykCEnQY5lKwHq1KmxpfascbG0bIl1nCEOc5kCM/
+LaEMAP+90p9Wr1VVe8LqeTt9oiylrLEsDI7aNiw0FtIT0QihOfuN9hc3i8QQMPb6
+OYeA6jGWD9B+rqhn4fZyBTLz2etyEZf98apQIuxM+iOORohhFXY=
+=HpR+
+-----END PGP SIGNATURE-----
diff --git a/coreutils-disable_tests.patch b/coreutils-disable_tests.patch
index ad68a23..d5f78f3 100644
--- a/coreutils-disable_tests.patch
+++ b/coreutils-disable_tests.patch
@@ -6,18 +6,18 @@ Index: gnulib-tests/gnulib.mk
===================================================================
--- gnulib-tests/gnulib.mk.orig
+++ gnulib-tests/gnulib.mk
-@@ -1473,10 +1473,10 @@ EXTRA_DIST += test-getloadavg.c signatur
+@@ -1612,10 +1612,10 @@ EXTRA_DIST += test-getloadavg.c signatur
## begin gnulib module getlogin-tests
-TESTS += test-getlogin
-check_PROGRAMS += test-getlogin
--test_getlogin_LDADD = $(LDADD) $(GETLOGIN_LIB)
+-test_getlogin_LDADD = $(LDADD) $(GETLOGIN_LIB) $(LIBINTL)
-EXTRA_DIST += test-getlogin.c test-getlogin.h signature.h macros.h
-+# TESTS += test-getlogin
-+# check_PROGRAMS += test-getlogin
-+# test_getlogin_LDADD = $(LDADD) $(GETLOGIN_LIB)
-+# EXTRA_DIST += test-getlogin.c test-getlogin.h signature.h macros.h
++#TESTS += test-getlogin
++#check_PROGRAMS += test-getlogin
++#test_getlogin_LDADD = $(LDADD) $(GETLOGIN_LIB) $(LIBINTL)
++#EXTRA_DIST += test-getlogin.c test-getlogin.h signature.h macros.h
## end gnulib module getlogin-tests
diff --git a/coreutils-fix-gnulib-time_r-tests.patch b/coreutils-fix-gnulib-time_r-tests.patch
deleted file mode 100644
index d8036d3..0000000
--- a/coreutils-fix-gnulib-time_r-tests.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-2 upstream gnulib commits for coreutils-9.5 to skip localtime_r tests
-when the timezone 'Europe/Paris' does not work.
-
-Commit 1:
- http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=f130f5426ecd4edd559
-
-From f130f5426ecd4edd5596797e0a5721b927f80126 Mon Sep 17 00:00:00 2001
-From: Paul Eggert
-Date: Sat, 30 Mar 2024 13:28:01 -0600
-Subject: [PATCH 1/2] time_r-tests: skip French tests if no Europe/Paris
-
-* tests/test-localtime_r.c (main):
-* tests/test-localtime_r-mt.c (main):
-If TZ='Europe/Paris' does not work, skip these tests.
-
-Commit 2:
- http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=2c04db80e2c52b8f05b
-
-From 2c04db80e2c52b8f05b4136af955510e7d370470 Mon Sep 17 00:00:00 2001
-From: Bruno Haible
-Date: Sat, 30 Mar 2024 22:50:39 +0100
-Subject: [PATCH 2/2] time_r tests: Avoid misleading skip message on native
- Windows.
-
-* tests/test-localtime_r.c (main): Use the macro FRENCH_TZ.
-* tests/test-localtime_r-mt.c (main): Likewise.
----
- gnulib-tests/test-localtime_r-mt.c | 21 +++++++++++++++++++++
- gnulib-tests/test-localtime_r.c | 21 +++++++++++++++++++++
- 2 files changed, 42 insertions(+)
-
-Index: gnulib-tests/test-localtime_r-mt.c
-===================================================================
---- gnulib-tests/test-localtime_r-mt.c.orig
-+++ gnulib-tests/test-localtime_r-mt.c
-@@ -107,6 +107,27 @@ main (int argc, char *argv[])
- {
- setenv ("TZ", FRENCH_TZ, 1);
-
-+ /* Check that this TZ works. */
-+ {
-+ time_t t = 0; /* 1970-01-01 01:00:00 */
-+ struct tm *result = localtime (&t);
-+ if (! (result
-+ && result->tm_sec == 0
-+ && result->tm_min == 0
-+ && result->tm_hour == 1
-+ && result->tm_mday == 1
-+ && result->tm_mon == 1 - 1
-+ && result->tm_year == 1970 - 1900
-+ && result->tm_wday == 4
-+ && result->tm_yday == 0
-+ && result->tm_isdst == 0))
-+ {
-+ fputs ("Skipping test: TZ='" FRENCH_TZ "' is not Paris time\n",
-+ stderr);
-+ return 77;
-+ }
-+ }
-+
- /* Create the threads. */
- gl_thread_create (thread1_func, NULL);
- gl_thread_create (thread2_func, NULL);
-Index: gnulib-tests/test-localtime_r.c
-===================================================================
---- gnulib-tests/test-localtime_r.c.orig
-+++ gnulib-tests/test-localtime_r.c
-@@ -43,6 +43,27 @@ main (void)
- {
- setenv ("TZ", FRENCH_TZ, 1);
-
-+ /* Check that this TZ works. */
-+ {
-+ time_t t = 0; /* 1970-01-01 01:00:00 */
-+ struct tm *result = localtime (&t);
-+ if (! (result
-+ && result->tm_sec == 0
-+ && result->tm_min == 0
-+ && result->tm_hour == 1
-+ && result->tm_mday == 1
-+ && result->tm_mon == 1 - 1
-+ && result->tm_year == 1970 - 1900
-+ && result->tm_wday == 4
-+ && result->tm_yday == 0
-+ && result->tm_isdst == 0))
-+ {
-+ fputs ("Skipping test: TZ='" FRENCH_TZ "' is not Paris time\n",
-+ stderr);
-+ return 77;
-+ }
-+ }
-+
- /* Note: The result->tm_gmtoff values and the result->tm_zone values are the
- same (3600, "CET" or 7200, "CEST") across all tested platforms:
- glibc, musl, macOS, FreeBSD, NetBSD, OpenBSD, Minix, Cygwin, Android. */
diff --git a/coreutils-getaddrinfo.patch b/coreutils-getaddrinfo.patch
deleted file mode 100644
index 410d377..0000000
--- a/coreutils-getaddrinfo.patch
+++ /dev/null
@@ -1,21 +0,0 @@
----
- gnulib-tests/test-getaddrinfo.c | 6 +-----
- 1 file changed, 1 insertion(+), 5 deletions(-)
-
-Index: gnulib-tests/test-getaddrinfo.c
-===================================================================
---- gnulib-tests/test-getaddrinfo.c.orig
-+++ gnulib-tests/test-getaddrinfo.c
-@@ -93,11 +93,7 @@ simple (char const *host, char const *se
- the test merely because someone is down the country on their
- in-law's farm. */
- if (res == EAI_AGAIN)
-- {
-- skip++;
-- fprintf (stderr, "skipping getaddrinfo test: no network?\n");
-- return 77;
-- }
-+ return 0;
- /* IRIX reports EAI_NONAME for "https". Don't fail the test
- merely because of this. */
- if (res == EAI_NONAME)
diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch
index 7ce2f78..3296c0e 100644
--- a/coreutils-i18n.patch
+++ b/coreutils-i18n.patch
@@ -1,4 +1,4 @@
-From 3a1b92e80708319bcc89852e3da1029c3d1ff6b3 Mon Sep 17 00:00:00 2001
+From 3d25791ec9cc357a34620516d1c024ef17a4dd75 Mon Sep 17 00:00:00 2001
From: rpm-build
Date: Wed, 30 Aug 2023 17:19:58 +0200
Subject: [PATCH] coreutils-i18n.patch
@@ -7,34 +7,29 @@ Subject: [PATCH] coreutils-i18n.patch
bootstrap.conf | 2
configure.ac | 6
lib/linebuffer.h | 8
- lib/mbchar.c | 23 +
- lib/mbchar.h | 373 ++++++++++++++++++++
lib/mbfile.c | 20 +
- lib/mbfile.h | 267 ++++++++++++++
- m4/mbchar.m4 | 13
- m4/mbfile.m4 | 14
+ lib/mbfile.h | 283 +++++++++++++++
+ m4/mbfile.m4 | 16
src/cut.c | 508 ++++++++++++++++++++++++++--
src/expand-common.c | 114 ++++++
src/expand-common.h | 12
src/expand.c | 90 ++++-
- src/fold.c | 312 +++++++++++++++--
src/local.mk | 4
src/pr.c | 443 ++++++++++++++++++++++--
- src/sort.c | 792 +++++++++++++++++++++++++++++++++++++++++---
- src/unexpand.c | 102 ++++-
+ src/sort.c | 790 +++++++++++++++++++++++++++++++++++++++++---
+ src/unexpand.c | 101 ++++-
tests/Coreutils.pm | 3
tests/expand/mb.sh | 183 ++++++++++
tests/i18n/sort.sh | 29 +
tests/local.mk | 4
tests/misc/expand.pl | 42 ++
- tests/misc/fold.pl | 50 ++
tests/misc/sort-mb-tests.sh | 45 ++
tests/misc/unexpand.pl | 39 ++
tests/pr/pr-tests.pl | 49 ++
tests/sort/sort-merge.pl | 42 ++
tests/sort/sort.pl | 40 ++
tests/unexpand/mb.sh | 172 +++++++++
- 30 files changed, 3605 insertions(+), 196 deletions(-)
+ 25 files changed, 2878 insertions(+), 167 deletions(-)
create mode 100644 lib/mbfile.c
create mode 100644 lib/mbfile.h
create mode 100644 m4/mbfile.m4
@@ -43,11 +38,11 @@ Subject: [PATCH] coreutils-i18n.patch
create mode 100755 tests/misc/sort-mb-tests.sh
create mode 100755 tests/unexpand/mb.sh
-Index: coreutils-9.5/bootstrap.conf
+Index: bootstrap.conf
===================================================================
---- coreutils-9.5.orig/bootstrap.conf
-+++ coreutils-9.5/bootstrap.conf
-@@ -163,6 +163,8 @@ gnulib_modules="
+--- bootstrap.conf.orig
++++ bootstrap.conf
+@@ -169,6 +169,8 @@ gnulib_modules="
maintainer-makefile
malloc-gnu
manywarnings
@@ -56,11 +51,11 @@ Index: coreutils-9.5/bootstrap.conf
mbrlen
mbrtoc32
mbrtowc
-Index: coreutils-9.5/configure.ac
+Index: configure.ac
===================================================================
---- coreutils-9.5.orig/configure.ac
-+++ coreutils-9.5/configure.ac
-@@ -504,6 +504,12 @@ fi
+--- configure.ac.orig
++++ configure.ac
+@@ -465,6 +465,12 @@ fi
# I'm leaving it here for now. This whole thing needs to be modernized...
gl_WINSIZE_IN_PTEM
@@ -73,13 +68,13 @@ Index: coreutils-9.5/configure.ac
gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
-Index: coreutils-9.5/lib/linebuffer.h
+Index: lib/linebuffer.h
===================================================================
---- coreutils-9.5.orig/lib/linebuffer.h
-+++ coreutils-9.5/lib/linebuffer.h
-@@ -22,6 +22,11 @@
- # include "idx.h"
- # include
+--- lib/linebuffer.h.orig
++++ lib/linebuffer.h
+@@ -27,6 +27,11 @@ extern "C" {
+ #endif
+
+/* Get mbstate_t. */
+# if HAVE_WCHAR_H
@@ -89,7 +84,7 @@ Index: coreutils-9.5/lib/linebuffer.h
/* A 'struct linebuffer' holds a line of text. */
struct linebuffer
-@@ -29,6 +34,9 @@ struct linebuffer
+@@ -34,6 +39,9 @@ struct linebuffer
idx_t size; /* Allocated. */
idx_t length; /* Used. */
char *buffer;
@@ -99,13 +94,13 @@ Index: coreutils-9.5/lib/linebuffer.h
};
/* Initialize linebuffer LINEBUFFER for use. */
-Index: coreutils-9.5/lib/mbfile.c
+Index: lib/mbfile.c
===================================================================
--- /dev/null
-+++ coreutils-9.5/lib/mbfile.c
++++ lib/mbfile.c
@@ -0,0 +1,20 @@
+/* Multibyte character I/O: macros for multi-byte encodings.
-+ Copyright (C) 2012-2023 Free Software Foundation, Inc.
++ Copyright (C) 2012-2025 Free Software Foundation, Inc.
+
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
@@ -124,13 +119,13 @@ Index: coreutils-9.5/lib/mbfile.c
+
+#define MBFILE_INLINE _GL_EXTERN_INLINE
+#include "mbfile.h"
-Index: coreutils-9.5/lib/mbfile.h
+Index: lib/mbfile.h
===================================================================
--- /dev/null
-+++ coreutils-9.5/lib/mbfile.h
-@@ -0,0 +1,267 @@
++++ lib/mbfile.h
+@@ -0,0 +1,283 @@
+/* Multibyte character I/O: macros for multi-byte encodings.
-+ Copyright (C) 2001, 2005, 2009-2023 Free Software Foundation, Inc.
++ Copyright (C) 2001, 2005, 2009-2025 Free Software Foundation, Inc.
+
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
@@ -185,6 +180,7 @@ Index: coreutils-9.5/lib/mbfile.h
+
+#include
+#include
++#include
+#include
+#include
+
@@ -195,14 +191,22 @@ Index: coreutils-9.5/lib/mbfile.h
+# define MBFILE_INLINE _GL_INLINE
+#endif
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++
++/* Guarantee two characters of pushback. */
++#define MBFILE_MAX_PUSHBACK 2
++
+struct mbfile_multi {
+ FILE *fp;
+ bool eof_seen;
-+ bool have_pushback;
++ unsigned int pushback_count; /* <= MBFILE_MAX_PUSHBACK */
+ mbstate_t state;
+ unsigned int bufcount;
+ char buf[MBCHAR_BUF_SIZE];
-+ struct mbchar pushback;
++ struct mbchar pushback[MBFILE_MAX_PUSHBACK];
+};
+
+MBFILE_INLINE void
@@ -211,19 +215,19 @@ Index: coreutils-9.5/lib/mbfile.h
+ unsigned int new_bufcount;
+ size_t bytes;
+
++ /* Return character pushed back, if there is one. */
++ if (mbf->pushback_count > 0)
++ {
++ mb_copy (mbc, &mbf->pushback[mbf->pushback_count - 1]);
++ mbf->pushback_count--;
++ return;
++ }
++
+ /* If EOF has already been seen, don't use getc. This matters if
+ mbf->fp is connected to an interactive tty. */
+ if (mbf->eof_seen)
+ goto eof;
+
-+ /* Return character pushed back, if there is one. */
-+ if (mbf->have_pushback)
-+ {
-+ mb_copy (mbc, &mbf->pushback);
-+ mbf->have_pushback = false;
-+ return;
-+ }
-+
+ new_bufcount = mbf->bufcount;
+
+ /* If mbf->state is not in an initial state, some more 32-bit wide character
@@ -372,8 +376,10 @@ Index: coreutils-9.5/lib/mbfile.h
+MBFILE_INLINE void
+mbfile_multi_ungetc (const struct mbchar *mbc, struct mbfile_multi *mbf)
+{
-+ mb_copy (&mbf->pushback, mbc);
-+ mbf->have_pushback = true;
++ if (mbf->pushback_count == MBFILE_MAX_PUSHBACK)
++ abort ();
++ mb_copy (&mbf->pushback[mbf->pushback_count], mbc);
++ mbf->pushback_count++;
+}
+
+typedef struct mbfile_multi mb_file_t;
@@ -383,7 +389,7 @@ Index: coreutils-9.5/lib/mbfile.h
+#define mbf_init(mbf, stream) \
+ ((mbf).fp = (stream), \
+ (mbf).eof_seen = false, \
-+ (mbf).have_pushback = false, \
++ (mbf).pushback_count = 0, \
+ mbszero (&(mbf).state), \
+ (mbf).bufcount = 0)
+
@@ -393,19 +399,26 @@ Index: coreutils-9.5/lib/mbfile.h
+
+#define mb_iseof(mbc) ((mbc).bytes == 0)
+
++
++#ifdef __cplusplus
++}
++#endif
++
+_GL_INLINE_HEADER_END
+
+#endif /* _MBFILE_H */
-Index: coreutils-9.5/m4/mbfile.m4
+Index: m4/mbfile.m4
===================================================================
--- /dev/null
-+++ coreutils-9.5/m4/mbfile.m4
-@@ -0,0 +1,14 @@
-+# mbfile.m4 serial 7
-+dnl Copyright (C) 2005, 2008-2023 Free Software Foundation, Inc.
++++ m4/mbfile.m4
+@@ -0,0 +1,16 @@
++# mbfile.m4
++# serial 7
++dnl Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
++dnl This file is offered as-is, without any warranty.
+
+dnl autoconf tests required for use of mbfile.h
+dnl From Bruno Haible.
@@ -415,10 +428,10 @@ Index: coreutils-9.5/m4/mbfile.m4
+ AC_REQUIRE([AC_TYPE_MBSTATE_T])
+ :
+])
-Index: coreutils-9.5/src/cut.c
+Index: src/cut.c
===================================================================
---- coreutils-9.5.orig/src/cut.c
-+++ coreutils-9.5/src/cut.c
+--- src/cut.c.orig
++++ src/cut.c
@@ -27,6 +27,11 @@
#include
#include
@@ -1075,19 +1088,19 @@ Index: coreutils-9.5/src/cut.c
if (have_read_stdin && fclose (stdin) == EOF)
-Index: coreutils-9.5/src/expand-common.c
+Index: src/expand-common.c
===================================================================
---- coreutils-9.5.orig/src/expand-common.c
-+++ coreutils-9.5/src/expand-common.c
+--- src/expand-common.c.orig
++++ src/expand-common.c
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
#include "system.h"
+ #include "c-ctype.h"
#include "fadvise.h"
- #include "quote.h"
-@@ -123,6 +124,119 @@ set_increment_size (uintmax_t tabval)
+@@ -123,6 +124,119 @@ set_increment_size (colno tabval)
return ok;
}
@@ -1207,11 +1220,11 @@ Index: coreutils-9.5/src/expand-common.c
/* Add the comma or blank separated list of tab stops STOPS
to the list of tab stops. */
extern void
-Index: coreutils-9.5/src/expand-common.h
+Index: src/expand-common.h
===================================================================
---- coreutils-9.5.orig/src/expand-common.h
-+++ coreutils-9.5/src/expand-common.h
-@@ -25,6 +25,18 @@ extern size_t max_column_width;
+--- src/expand-common.h.orig
++++ src/expand-common.h
+@@ -29,6 +29,18 @@ extern idx_t max_column_width;
/* The desired exit status. */
extern int exit_status;
@@ -1229,11 +1242,11 @@ Index: coreutils-9.5/src/expand-common.h
+
/* Add tab stop TABVAL to the end of 'tab_list'. */
extern void
- add_tab_stop (uintmax_t tabval);
-Index: coreutils-9.5/src/expand.c
+ add_tab_stop (colno tabval);
+Index: src/expand.c
===================================================================
---- coreutils-9.5.orig/src/expand.c
-+++ coreutils-9.5/src/expand.c
+--- src/expand.c.orig
++++ src/expand.c
@@ -38,6 +38,9 @@
#include
#include
@@ -1292,7 +1305,7 @@ Index: coreutils-9.5/src/expand.c
@@ -118,17 +143,48 @@ expand (void)
/* Index in TAB_LIST of next tab stop to examine. */
- size_t tab_index = 0;
+ idx_t tab_index = 0;
-
/* Convert a line of text. */
@@ -1342,8 +1355,8 @@ Index: coreutils-9.5/src/expand.c
+ if (mb_iseq (c, '\t'))
{
/* Column the next input tab stop is on. */
- uintmax_t next_tab_column;
-@@ -147,32 +203,34 @@ expand (void)
+ bool last_tab;
+@@ -139,31 +195,33 @@ expand (void)
if (putchar (' ') < 0)
write_error ();
@@ -1362,14 +1375,13 @@ Index: coreutils-9.5/src/expand.c
+ /* A leading control character could make us trip over. */
+ else if (!mb_iscntrl (c))
{
-- column++;
-+ column += mb_width (c);
- if (!column)
+- if (ckd_add (&column, column, 1))
++ if (ckd_add (&column, column, mb_width (c)))
error (EXIT_FAILURE, 0, _("input line is too long"));
}
- convert &= convert_entire_line || !! isblank (c);
-+ convert &= convert_entire_line || mb_isblank (c);
++ convert &= convert_entire_line || !! mb_isblank (c);
}
- if (c < 0)
@@ -1386,415 +1398,11 @@ Index: coreutils-9.5/src/expand.c
}
}
-Index: coreutils-9.5/src/fold.c
+Index: src/local.mk
===================================================================
---- coreutils-9.5.orig/src/fold.c
-+++ coreutils-9.5/src/fold.c
-@@ -23,10 +23,32 @@
- #include
- #include
-
-+/* Get mbstate_t, mbrtowc(), wcwidth(). */
-+#if HAVE_WCHAR_H
-+# include
-+#endif
-+
-+/* Get iswprint(), iswblank(), wcwidth(). */
-+#if HAVE_WCTYPE_H
-+# include
-+#endif
-+
- #include "system.h"
- #include "fadvise.h"
- #include "xdectoint.h"
-
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
-+# undef MB_LEN_MAX
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
- #define TAB_WIDTH 8
-
- /* The official name of this program (e.g., no 'g' prefix). */
-@@ -34,20 +56,41 @@
-
- #define AUTHORS proper_name ("David MacKenzie")
-
-+#define FATAL_ERROR(Message) \
-+ do \
-+ { \
-+ error (0, 0, (Message)); \
-+ usage (2); \
-+ } \
-+ while (0)
-+
-+enum operating_mode
-+{
-+ /* Fold texts by columns that are at the given positions. */
-+ column_mode,
-+
-+ /* Fold texts by bytes that are at the given positions. */
-+ byte_mode,
-+
-+ /* Fold texts by characters that are at the given positions. */
-+ character_mode,
-+};
-+
-+/* The argument shows current mode. (Default: column_mode) */
-+static enum operating_mode operating_mode;
-+
- /* If nonzero, try to break on whitespace. */
- static bool break_spaces;
-
--/* If nonzero, count bytes, not column positions. */
--static bool count_bytes;
--
- /* If nonzero, at least one of the files we read was standard input. */
- static bool have_read_stdin;
-
--static char const shortopts[] = "bsw:0::1::2::3::4::5::6::7::8::9::";
-+static char const shortopts[] = "bcsw:0::1::2::3::4::5::6::7::8::9::";
-
- static struct option const longopts[] =
- {
- {"bytes", no_argument, nullptr, 'b'},
-+ {"characters", no_argument, nullptr, 'c'},
- {"spaces", no_argument, nullptr, 's'},
- {"width", required_argument, nullptr, 'w'},
- {GETOPT_HELP_OPTION_DECL},
-@@ -75,6 +118,7 @@ Wrap input lines in each FILE, writing t
-
- fputs (_("\
- -b, --bytes count bytes rather than columns\n\
-+ -c, --characters count characters rather than columns\n\
- -s, --spaces break at spaces\n\
- -w, --width=WIDTH use WIDTH columns instead of 80\n\
- "), stdout);
-@@ -92,7 +136,7 @@ Wrap input lines in each FILE, writing t
- static size_t
- adjust_column (size_t column, char c)
- {
-- if (!count_bytes)
-+ if (operating_mode != byte_mode)
- {
- if (c == '\b')
- {
-@@ -115,30 +159,14 @@ adjust_column (size_t column, char c)
- to stdout, with maximum line length WIDTH.
- Return true if successful. */
-
--static bool
--fold_file (char const *filename, size_t width)
-+static void
-+fold_text (FILE *istream, size_t width, int *saved_errno)
- {
-- FILE *istream;
- int c;
- size_t column = 0; /* Screen column where next char will go. */
- size_t offset_out = 0; /* Index in 'line_out' for next char. */
- static char *line_out = nullptr;
- static size_t allocated_out = 0;
-- int saved_errno;
--
-- if (STREQ (filename, "-"))
-- {
-- istream = stdin;
-- have_read_stdin = true;
-- }
-- else
-- istream = fopen (filename, "r");
--
-- if (istream == nullptr)
-- {
-- error (0, errno, "%s", quotef (filename));
-- return false;
-- }
-
- fadvise (istream, FADVISE_SEQUENTIAL);
-
-@@ -168,6 +196,15 @@ fold_file (char const *filename, size_t
- bool found_blank = false;
- size_t logical_end = offset_out;
-
-+ /* If LINE_OUT has no wide character,
-+ put a new wide character in LINE_OUT
-+ if column is bigger than width. */
-+ if (offset_out == 0)
-+ {
-+ line_out[offset_out++] = c;
-+ continue;
-+ }
-+
- /* Look for the last blank. */
- while (logical_end)
- {
-@@ -214,13 +251,225 @@ fold_file (char const *filename, size_t
- line_out[offset_out++] = c;
- }
-
-- saved_errno = errno;
-+ *saved_errno = errno;
- if (!ferror (istream))
-- saved_errno = 0;
-+ *saved_errno = 0;
-
- if (offset_out)
- fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
-
-+}
-+
-+#if HAVE_MBRTOWC
-+static void
-+fold_multibyte_text (FILE *istream, size_t width, int *saved_errno)
-+{
-+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
-+ size_t buflen = 0; /* The length of the byte sequence in buf. */
-+ char *bufpos = buf; /* Next read position of BUF. */
-+ wint_t wc; /* A gotten wide character. */
-+ size_t mblength; /* The byte size of a multibyte character which shows
-+ as same character as WC. */
-+ mbstate_t state, state_bak; /* State of the stream. */
-+ int convfail = 0; /* 1, when conversion is failed. Otherwise 0. */
-+
-+ static char *line_out = NULL;
-+ size_t offset_out = 0; /* Index in `line_out' for next char. */
-+ static size_t allocated_out = 0;
-+
-+ int increment;
-+ size_t column = 0;
-+
-+ size_t last_blank_pos;
-+ size_t last_blank_column;
-+ int is_blank_seen;
-+ int last_blank_increment = 0;
-+ int is_bs_following_last_blank;
-+ size_t bs_following_last_blank_num;
-+ int is_cr_after_last_blank;
-+
-+#define CLEAR_FLAGS \
-+ do \
-+ { \
-+ last_blank_pos = 0; \
-+ last_blank_column = 0; \
-+ is_blank_seen = 0; \
-+ is_bs_following_last_blank = 0; \
-+ bs_following_last_blank_num = 0; \
-+ is_cr_after_last_blank = 0; \
-+ } \
-+ while (0)
-+
-+#define START_NEW_LINE \
-+ do \
-+ { \
-+ putchar ('\n'); \
-+ column = 0; \
-+ offset_out = 0; \
-+ CLEAR_FLAGS; \
-+ } \
-+ while (0)
-+
-+ CLEAR_FLAGS;
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ for (;; bufpos += mblength, buflen -= mblength)
-+ {
-+ if (buflen < MB_LEN_MAX && !feof (istream) && !ferror (istream))
-+ {
-+ memmove (buf, bufpos, buflen);
-+ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, istream);
-+ bufpos = buf;
-+ }
-+
-+ if (buflen < 1)
-+ break;
-+
-+ /* Get a wide character. */
-+ state_bak = state;
-+ mblength = mbrtowc ((wchar_t *)&wc, bufpos, buflen, &state);
-+
-+ switch (mblength)
-+ {
-+ case (size_t)-1:
-+ case (size_t)-2:
-+ convfail++;
-+ state = state_bak;
-+ /* Fall through. */
-+
-+ case 0:
-+ mblength = 1;
-+ break;
-+ }
-+
-+rescan:
-+ if (operating_mode == byte_mode) /* byte mode */
-+ increment = mblength;
-+ else if (operating_mode == character_mode) /* character mode */
-+ increment = 1;
-+ else /* column mode */
-+ {
-+ if (convfail)
-+ increment = 1;
-+ else
-+ {
-+ switch (wc)
-+ {
-+ case L'\n':
-+ fwrite (line_out, sizeof(char), offset_out, stdout);
-+ START_NEW_LINE;
-+ continue;
-+
-+ case L'\b':
-+ increment = (column > 0) ? -1 : 0;
-+ break;
-+
-+ case L'\r':
-+ increment = -1 * column;
-+ break;
-+
-+ case L'\t':
-+ increment = 8 - column % 8;
-+ break;
-+
-+ default:
-+ increment = wcwidth (wc);
-+ increment = (increment < 0) ? 0 : increment;
-+ }
-+ }
-+ }
-+
-+ if (column + increment > width && break_spaces && last_blank_pos)
-+ {
-+ fwrite (line_out, sizeof(char), last_blank_pos, stdout);
-+ putchar ('\n');
-+
-+ offset_out = offset_out - last_blank_pos;
-+ column = column - last_blank_column + ((is_cr_after_last_blank)
-+ ? last_blank_increment : bs_following_last_blank_num);
-+ memmove (line_out, line_out + last_blank_pos, offset_out);
-+ CLEAR_FLAGS;
-+ goto rescan;
-+ }
-+
-+ if (column + increment > width && column != 0)
-+ {
-+ fwrite (line_out, sizeof(char), offset_out, stdout);
-+ START_NEW_LINE;
-+ goto rescan;
-+ }
-+
-+ if (allocated_out < offset_out + mblength)
-+ {
-+ line_out = X2REALLOC (line_out, &allocated_out);
-+ }
-+
-+ memcpy (line_out + offset_out, bufpos, mblength);
-+ offset_out += mblength;
-+ column += increment;
-+
-+ if (is_blank_seen && !convfail && wc == L'\r')
-+ is_cr_after_last_blank = 1;
-+
-+ if (is_bs_following_last_blank && !convfail && wc == L'\b')
-+ ++bs_following_last_blank_num;
-+ else
-+ is_bs_following_last_blank = 0;
-+
-+ if (break_spaces && !convfail && iswblank (wc))
-+ {
-+ last_blank_pos = offset_out;
-+ last_blank_column = column;
-+ is_blank_seen = 1;
-+ last_blank_increment = increment;
-+ is_bs_following_last_blank = 1;
-+ bs_following_last_blank_num = 0;
-+ is_cr_after_last_blank = 0;
-+ }
-+ }
-+
-+ *saved_errno = errno;
-+ if (!ferror (istream))
-+ *saved_errno = 0;
-+
-+ if (offset_out)
-+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
-+
-+}
-+#endif
-+
-+/* Fold file FILENAME, or standard input if FILENAME is "-",
-+ to stdout, with maximum line length WIDTH.
-+ Return true if successful. */
-+
-+static bool
-+fold_file (char const *filename, size_t width)
-+{
-+ FILE *istream;
-+ int saved_errno;
-+
-+ if (STREQ (filename, "-"))
-+ {
-+ istream = stdin;
-+ have_read_stdin = true;
-+ }
-+ else
-+ istream = fopen (filename, "r");
-+
-+ if (istream == nullptr)
-+ {
-+ error (0, errno, "%s", filename);
-+ return false;
-+ }
-+
-+ /* Define how ISTREAM is being folded. */
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ fold_multibyte_text (istream, width, &saved_errno);
-+ else
-+#endif
-+ fold_text (istream, width, &saved_errno);
-+
- if (STREQ (filename, "-"))
- clearerr (istream);
- else if (fclose (istream) != 0 && !saved_errno)
-@@ -251,7 +500,8 @@ main (int argc, char **argv)
-
- atexit (close_stdout);
-
-- break_spaces = count_bytes = have_read_stdin = false;
-+ operating_mode = column_mode;
-+ break_spaces = have_read_stdin = false;
-
- while ((optc = getopt_long (argc, argv, shortopts, longopts, nullptr)) != -1)
- {
-@@ -260,7 +510,15 @@ main (int argc, char **argv)
- switch (optc)
- {
- case 'b': /* Count bytes rather than columns. */
-- count_bytes = true;
-+ if (operating_mode != column_mode)
-+ FATAL_ERROR (_("only one way of folding may be specified"));
-+ operating_mode = byte_mode;
-+ break;
-+
-+ case 'c':
-+ if (operating_mode != column_mode)
-+ FATAL_ERROR (_("only one way of folding may be specified"));
-+ operating_mode = character_mode;
- break;
-
- case 's': /* Break at word boundaries. */
-Index: coreutils-9.5/src/local.mk
-===================================================================
---- coreutils-9.5.orig/src/local.mk
-+++ coreutils-9.5/src/local.mk
-@@ -450,8 +450,8 @@ src_base32_CPPFLAGS = -DBASE_TYPE=32 $(A
+--- src/local.mk.orig
++++ src/local.mk
+@@ -479,8 +479,8 @@ src_base32_CPPFLAGS = -DBASE_TYPE=32 $(A
src_basenc_SOURCES = src/basenc.c
src_basenc_CPPFLAGS = -DBASE_TYPE=42 $(AM_CPPFLAGS)
@@ -1805,10 +1413,10 @@ Index: coreutils-9.5/src/local.mk
src_wc_SOURCES = src/wc.c
if USE_AVX2_WC_LINECOUNT
-Index: coreutils-9.5/src/pr.c
+Index: src/pr.c
===================================================================
---- coreutils-9.5.orig/src/pr.c
-+++ coreutils-9.5/src/pr.c
+--- src/pr.c.orig
++++ src/pr.c
@@ -312,6 +312,24 @@
#include
#include
@@ -1832,9 +1440,9 @@ Index: coreutils-9.5/src/pr.c
+#endif
+
#include "system.h"
+ #include "c-ctype.h"
#include "fadvise.h"
- #include "hard-locale.h"
-@@ -324,6 +342,18 @@
+@@ -325,6 +343,18 @@
#include "xstrtol-error.h"
#include "xdectoint.h"
@@ -1853,7 +1461,7 @@ Index: coreutils-9.5/src/pr.c
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "pr"
-@@ -416,7 +446,20 @@ struct COLUMN
+@@ -417,7 +447,20 @@ struct COLUMN
typedef struct COLUMN COLUMN;
@@ -1875,9 +1483,9 @@ Index: coreutils-9.5/src/pr.c
static bool read_line (COLUMN *p);
static bool print_page (void);
static bool print_stored (COLUMN *p);
-@@ -428,6 +471,7 @@ static void add_line_number (COLUMN *p);
- static void getoptnum (char const *n_str, int min, int *num,
- char const *errfmt);
+@@ -428,6 +471,7 @@ static void pad_across_to (int position)
+ static void add_line_number (COLUMN *p);
+ static int getoptnum (char const *n_str, int min, char const *errfmt);
static void getoptarg (char *arg, char switch_char, char *character,
+ int *character_length, int *character_width,
int *number);
@@ -2010,7 +1618,7 @@ Index: coreutils-9.5/src/pr.c
/* Could check tab width > 0. */
tabify_output = true;
break;
-@@ -985,8 +1068,8 @@ main (int argc, char **argv)
+@@ -986,8 +1069,8 @@ main (int argc, char **argv)
case 'n':
numbered_lines = true;
if (optarg)
@@ -2021,7 +1629,7 @@ Index: coreutils-9.5/src/pr.c
break;
case 'N':
skip_count = false;
-@@ -1011,6 +1094,7 @@ main (int argc, char **argv)
+@@ -1013,6 +1096,7 @@ main (int argc, char **argv)
/* Reset an additional input of -s, -S dominates -s */
col_sep_string = "";
col_sep_length = 0;
@@ -2029,7 +1637,7 @@ Index: coreutils-9.5/src/pr.c
use_col_separator = true;
if (optarg)
separator_string (optarg);
-@@ -1165,7 +1249,8 @@ getoptnum (char const *n_str, int min, i
+@@ -1168,7 +1252,8 @@ getoptnum (char const *n_str, int min, c
a number. */
static void
@@ -2039,10 +1647,10 @@ Index: coreutils-9.5/src/pr.c
{
if (!*arg)
{
-@@ -1174,7 +1259,41 @@ getoptarg (char *arg, char switch_char,
+@@ -1177,7 +1262,41 @@ getoptarg (char *arg, char switch_char,
}
- if (!ISDIGIT (*arg))
+ if (!c_isdigit (*arg))
- *character = *arg++;
+ {
+#ifdef HAVE_MBRTOWC
@@ -2082,7 +1690,7 @@ Index: coreutils-9.5/src/pr.c
if (*arg)
{
long int tmp_long;
-@@ -1203,6 +1322,11 @@ static void
+@@ -1206,6 +1325,11 @@ static void
init_parameters (int number_of_files)
{
int chars_used_by_number = 0;
@@ -2094,7 +1702,7 @@ Index: coreutils-9.5/src/pr.c
lines_per_body = lines_per_page - lines_per_header - lines_per_footer;
if (lines_per_body <= 0)
-@@ -1240,7 +1364,7 @@ init_parameters (int number_of_files)
+@@ -1243,7 +1367,7 @@ init_parameters (int number_of_files)
else
col_sep_string = column_separator;
@@ -2103,7 +1711,7 @@ Index: coreutils-9.5/src/pr.c
use_col_separator = true;
}
/* It's rather pointless to define a TAB separator with column
-@@ -1272,11 +1396,11 @@ init_parameters (int number_of_files)
+@@ -1275,11 +1399,11 @@ init_parameters (int number_of_files)
+ TAB_WIDTH (chars_per_input_tab, chars_per_number); */
/* Estimate chars_per_text without any margin and keep it constant. */
@@ -2117,7 +1725,7 @@ Index: coreutils-9.5/src/pr.c
/* The number is part of the column width unless we are
printing files in parallel. */
-@@ -1285,7 +1409,7 @@ init_parameters (int number_of_files)
+@@ -1288,7 +1412,7 @@ init_parameters (int number_of_files)
}
int sep_chars, useful_chars;
@@ -2126,7 +1734,7 @@ Index: coreutils-9.5/src/pr.c
sep_chars = INT_MAX;
if (ckd_sub (&useful_chars, chars_per_line - chars_used_by_number,
sep_chars))
-@@ -1308,7 +1432,7 @@ init_parameters (int number_of_files)
+@@ -1311,7 +1435,7 @@ init_parameters (int number_of_files)
We've to use 8 as the lower limit, if we use chars_per_default_tab = 8
to expand a tab which is not an input_tab-char. */
free (clump_buff);
@@ -2135,7 +1743,7 @@ Index: coreutils-9.5/src/pr.c
}
/* Open the necessary files,
-@@ -1414,7 +1538,7 @@ init_funcs (void)
+@@ -1417,7 +1541,7 @@ init_funcs (void)
/* Enlarge p->start_position of first column to use the same form of
padding_not_printed with all columns. */
@@ -2144,7 +1752,7 @@ Index: coreutils-9.5/src/pr.c
/* This loop takes care of all but the rightmost column. */
-@@ -1448,7 +1572,7 @@ init_funcs (void)
+@@ -1451,7 +1575,7 @@ init_funcs (void)
}
else
{
@@ -2153,7 +1761,7 @@ Index: coreutils-9.5/src/pr.c
h_next = h + chars_per_column;
}
}
-@@ -1745,9 +1869,9 @@ static void
+@@ -1748,9 +1872,9 @@ static void
align_column (COLUMN *p)
{
padding_not_printed = p->start_position;
@@ -2165,9 +1773,9 @@ Index: coreutils-9.5/src/pr.c
padding_not_printed = ANYWHERE;
}
-@@ -2021,13 +2145,13 @@ store_char (char c)
+@@ -2024,13 +2148,13 @@ store_char (char c)
/* May be too generous. */
- buff = X2REALLOC (buff, &buff_allocated);
+ buff = xpalloc (buff, &buff_allocated, 1, -1, sizeof *buff);
}
- buff[buff_current++] = c;
+ buff[buff_current++] = (unsigned char) c;
@@ -2181,7 +1789,7 @@ Index: coreutils-9.5/src/pr.c
char *s;
int num_width;
-@@ -2044,22 +2168,24 @@ add_line_number (COLUMN *p)
+@@ -2047,22 +2171,24 @@ add_line_number (COLUMN *p)
/* Tabification is assumed for multiple columns, also for n-separators,
but 'default n-separator = TAB' hasn't been given priority over
equal column_width also specified by POSIX. */
@@ -2210,7 +1818,7 @@ Index: coreutils-9.5/src/pr.c
output_position = POS_AFTER_TAB (chars_per_output_tab,
output_position);
}
-@@ -2218,7 +2344,7 @@ print_white_space (void)
+@@ -2221,7 +2347,7 @@ print_white_space (void)
while (goal - h_old > 1
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
{
@@ -2219,7 +1827,7 @@ Index: coreutils-9.5/src/pr.c
h_old = h_new;
}
while (++h_old <= goal)
-@@ -2238,6 +2364,7 @@ print_sep_string (void)
+@@ -2241,6 +2367,7 @@ print_sep_string (void)
{
char const *s = col_sep_string;
int l = col_sep_length;
@@ -2227,7 +1835,7 @@ Index: coreutils-9.5/src/pr.c
if (separators_not_printed <= 0)
{
-@@ -2249,6 +2376,7 @@ print_sep_string (void)
+@@ -2252,6 +2379,7 @@ print_sep_string (void)
{
for (; separators_not_printed > 0; --separators_not_printed)
{
@@ -2235,7 +1843,7 @@ Index: coreutils-9.5/src/pr.c
while (l-- > 0)
{
/* 3 types of sep_strings: spaces only, spaces and chars,
-@@ -2262,12 +2390,15 @@ print_sep_string (void)
+@@ -2265,12 +2393,15 @@ print_sep_string (void)
}
else
{
@@ -2252,7 +1860,7 @@ Index: coreutils-9.5/src/pr.c
/* sep_string ends with some spaces */
if (spaces_not_printed > 0)
print_white_space ();
-@@ -2295,7 +2426,7 @@ print_clump (COLUMN *p, int n, char *clu
+@@ -2298,7 +2429,7 @@ print_clump (COLUMN *p, int n, char *clu
required number of tabs and spaces. */
static void
@@ -2261,7 +1869,7 @@ Index: coreutils-9.5/src/pr.c
{
if (tabify_output)
{
-@@ -2319,6 +2450,74 @@ print_char (char c)
+@@ -2322,6 +2453,74 @@ print_char (char c)
putchar (c);
}
@@ -2336,7 +1944,7 @@ Index: coreutils-9.5/src/pr.c
/* Skip to page PAGE before printing.
PAGE may be larger than total number of pages. */
-@@ -2495,9 +2694,9 @@ read_line (COLUMN *p)
+@@ -2498,9 +2697,9 @@ read_line (COLUMN *p)
align_empty_cols = false;
}
@@ -2348,7 +1956,7 @@ Index: coreutils-9.5/src/pr.c
padding_not_printed = ANYWHERE;
}
-@@ -2566,7 +2765,7 @@ print_stored (COLUMN *p)
+@@ -2569,7 +2768,7 @@ print_stored (COLUMN *p)
COLUMN *q;
int line = p->current_line++;
@@ -2357,7 +1965,7 @@ Index: coreutils-9.5/src/pr.c
/* FIXME
UMR: Uninitialized memory read:
* This is occurring while in:
-@@ -2578,7 +2777,7 @@ print_stored (COLUMN *p)
+@@ -2581,7 +2780,7 @@ print_stored (COLUMN *p)
xmalloc [xmalloc.c:94]
init_store_cols [pr.c:1648]
*/
@@ -2366,7 +1974,7 @@ Index: coreutils-9.5/src/pr.c
pad_vertically = true;
-@@ -2598,9 +2797,9 @@ print_stored (COLUMN *p)
+@@ -2601,9 +2800,9 @@ print_stored (COLUMN *p)
}
}
@@ -2378,7 +1986,7 @@ Index: coreutils-9.5/src/pr.c
padding_not_printed = ANYWHERE;
}
-@@ -2613,8 +2812,8 @@ print_stored (COLUMN *p)
+@@ -2616,8 +2815,8 @@ print_stored (COLUMN *p)
if (spaces_not_printed == 0)
{
output_position = p->start_position + end_vector[line];
@@ -2389,7 +1997,7 @@ Index: coreutils-9.5/src/pr.c
}
return true;
-@@ -2633,7 +2832,7 @@ print_stored (COLUMN *p)
+@@ -2636,7 +2835,7 @@ print_stored (COLUMN *p)
number of characters is 1.) */
static int
@@ -2398,7 +2006,7 @@ Index: coreutils-9.5/src/pr.c
{
unsigned char uc = c;
char *s = clump_buff;
-@@ -2643,10 +2842,10 @@ char_to_clump (char c)
+@@ -2646,10 +2845,10 @@ char_to_clump (char c)
int chars;
int chars_per_c = 8;
@@ -2411,7 +2019,7 @@ Index: coreutils-9.5/src/pr.c
{
width = TAB_WIDTH (chars_per_c, input_position);
-@@ -2727,6 +2926,164 @@ char_to_clump (char c)
+@@ -2730,6 +2929,164 @@ char_to_clump (char c)
return chars;
}
@@ -2576,10 +2184,10 @@ Index: coreutils-9.5/src/pr.c
/* We've just printed some files and need to clean up things before
looking for more options and printing the next batch of files.
-Index: coreutils-9.5/src/sort.c
+Index: src/sort.c
===================================================================
---- coreutils-9.5.orig/src/sort.c
-+++ coreutils-9.5/src/sort.c
+--- src/sort.c.orig
++++ src/sort.c
@@ -29,6 +29,14 @@
#include
#include
@@ -2595,7 +2203,7 @@ Index: coreutils-9.5/src/sort.c
#include "system.h"
#include "argmatch.h"
#include "assure.h"
-@@ -157,14 +165,39 @@ static int thousands_sep;
+@@ -158,14 +166,39 @@ static int thousands_sep;
/* We currently ignore multi-byte grouping chars. */
static bool thousands_sep_ignored;
@@ -2636,7 +2244,7 @@ Index: coreutils-9.5/src/sort.c
/* The kind of blanks for '-b' to skip in various options. */
enum blanktype { bl_start, bl_end, bl_both };
-@@ -341,13 +374,11 @@ static bool stable;
+@@ -342,13 +375,11 @@ static bool stable;
/* An int value outside char range. */
enum { NON_CHAR = CHAR_MAX + 1 };
@@ -2653,7 +2261,7 @@ Index: coreutils-9.5/src/sort.c
/* Flag to remove consecutive duplicate lines from the output.
Only the last of a sequence of equal lines will be output. */
-@@ -804,6 +835,46 @@ reap_all (void)
+@@ -806,6 +837,46 @@ reap_all (void)
reap (-1);
}
@@ -2700,7 +2308,7 @@ Index: coreutils-9.5/src/sort.c
/* Clean up any remaining temporary files. */
static void
-@@ -1271,7 +1342,7 @@ zaptemp (char const *name)
+@@ -1273,7 +1344,7 @@ zaptemp (char const *name)
free (node);
}
@@ -2709,7 +2317,7 @@ Index: coreutils-9.5/src/sort.c
static int
struct_month_cmp (void const *m1, void const *m2)
-@@ -1286,7 +1357,7 @@ struct_month_cmp (void const *m1, void c
+@@ -1288,7 +1359,7 @@ struct_month_cmp (void const *m1, void c
/* Initialize the character class tables. */
static void
@@ -2718,7 +2326,7 @@ Index: coreutils-9.5/src/sort.c
{
size_t i;
-@@ -1298,7 +1369,7 @@ inittables (void)
+@@ -1300,7 +1371,7 @@ inittables (void)
fold_toupper[i] = toupper (i);
}
@@ -2834,7 +2442,7 @@ Index: coreutils-9.5/src/sort.c
++ptr;
if (ptr < lim)
++ptr;
-@@ -1649,12 +1798,71 @@ begfield (struct line const *line, struc
+@@ -1653,12 +1802,71 @@ begfield (struct line const *line, struc
return ptr;
}
@@ -2907,7 +2515,7 @@ Index: coreutils-9.5/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar;
-@@ -1669,10 +1877,10 @@ limfield (struct line const *line, struc
+@@ -1673,10 +1881,10 @@ limfield (struct line const *line, struc
'beginning' is the first character following the delimiting TAB.
Otherwise, leave PTR pointing at the first 'blank' character after
the preceding field. */
@@ -2920,7 +2528,7 @@ Index: coreutils-9.5/src/sort.c
++ptr;
if (ptr < lim && (eword || echar))
++ptr;
-@@ -1718,10 +1926,10 @@ limfield (struct line const *line, struc
+@@ -1722,10 +1930,10 @@ limfield (struct line const *line, struc
*/
/* Make LIM point to the end of (one byte past) the current field. */
@@ -2933,7 +2541,7 @@ Index: coreutils-9.5/src/sort.c
if (newlim)
lim = newlim;
}
-@@ -1752,6 +1960,130 @@ limfield (struct line const *line, struc
+@@ -1760,6 +1968,130 @@ limfield (struct line const *line, struc
return ptr;
}
@@ -3064,7 +2672,7 @@ Index: coreutils-9.5/src/sort.c
/* Fill BUF reading from FP, moving buf->left bytes from the end
of buf->buf to the beginning first. If EOF is reached and the
file wasn't terminated by a newline, supply one. Set up BUF's line
-@@ -1838,8 +2170,22 @@ fillbuf (struct buffer *buf, FILE *fp, c
+@@ -1846,8 +2178,22 @@ fillbuf (struct buffer *buf, FILE *fp, c
else
{
if (key->skipsblanks)
@@ -3089,7 +2697,7 @@ Index: coreutils-9.5/src/sort.c
line->keybeg = line_start;
}
}
-@@ -1977,12 +2323,10 @@ find_unit_order (char const *number)
+@@ -1985,12 +2331,10 @@ find_unit_order (char const *number)
ATTRIBUTE_PURE
static int
@@ -3105,7 +2713,7 @@ Index: coreutils-9.5/src/sort.c
int diff = find_unit_order (a) - find_unit_order (b);
return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep));
-@@ -1994,7 +2338,7 @@ human_numcompare (char const *a, char co
+@@ -2002,7 +2346,7 @@ human_numcompare (char const *a, char co
ATTRIBUTE_PURE
static int
@@ -3114,7 +2722,7 @@ Index: coreutils-9.5/src/sort.c
{
while (blanks[to_uchar (*a)])
a++;
-@@ -2004,6 +2348,25 @@ numcompare (char const *a, char const *b
+@@ -2012,6 +2356,25 @@ numcompare (char const *a, char const *b
return strnumcmp (a, b, decimal_point, thousands_sep);
}
@@ -3140,7 +2748,7 @@ Index: coreutils-9.5/src/sort.c
static int
nan_compare (long double a, long double b)
{
-@@ -2045,7 +2408,7 @@ general_numcompare (char const *sa, char
+@@ -2053,7 +2416,7 @@ general_numcompare (char const *sa, char
Return 0 if the name in S is not recognized. */
static int
@@ -3149,7 +2757,7 @@ Index: coreutils-9.5/src/sort.c
{
size_t lo = 0;
size_t hi = MONTHS_PER_YEAR;
-@@ -2372,15 +2735,14 @@ debug_key (struct line const *line, stru
+@@ -2392,15 +2755,14 @@ debug_key (struct line const *line, stru
char saved = *lim;
*lim = '\0';
@@ -3167,7 +2775,7 @@ Index: coreutils-9.5/src/sort.c
else if (key->general_numeric)
ignore_value (strtold (beg, &tighter_lim));
else if (key->numeric || key->human_numeric)
-@@ -2526,7 +2888,7 @@ key_warnings (struct keyfield const *gke
+@@ -2546,7 +2908,7 @@ key_warnings (struct keyfield const *gke
/* Warn about significant leading blanks. */
bool implicit_skip = key_numeric (key) || key->month;
bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */
@@ -3176,7 +2784,7 @@ Index: coreutils-9.5/src/sort.c
&& ((!key->skipsblanks && !implicit_skip)
|| (!key->skipsblanks && key->schar)
|| (!key->skipeblanks && key->echar)))
-@@ -2574,9 +2936,9 @@ key_warnings (struct keyfield const *gke
+@@ -2594,9 +2956,9 @@ key_warnings (struct keyfield const *gke
bool number_locale_warned = false;
if (basic_numeric_field_span)
{
@@ -3189,7 +2797,7 @@ Index: coreutils-9.5/src/sort.c
{
error (0, 0,
_("field separator %s is treated as a "
-@@ -2587,9 +2949,9 @@ key_warnings (struct keyfield const *gke
+@@ -2607,9 +2969,9 @@ key_warnings (struct keyfield const *gke
}
if (basic_numeric_field_span || general_numeric_field_span)
{
@@ -3202,7 +2810,7 @@ Index: coreutils-9.5/src/sort.c
{
error (0, 0,
_("field separator %s is treated as a "
-@@ -2597,19 +2959,19 @@ key_warnings (struct keyfield const *gke
+@@ -2617,19 +2979,19 @@ key_warnings (struct keyfield const *gke
quote (((char []) {decimal_point, 0})));
number_locale_warned = true;
}
@@ -3226,17 +2834,8 @@ Index: coreutils-9.5/src/sort.c
}
}
-@@ -2620,7 +2982,7 @@ key_warnings (struct keyfield const *gke
- {
- error (0, 0,
- _("%snumbers use %s as a decimal point in this locale"),
-- tab == decimal_point ? "" : _("note "),
-+ (tab_length && tab[0] == decimal_point) ? "" : _("note "),
- quote (((char []) {decimal_point, 0})));
-
- }
-@@ -2662,11 +3024,87 @@ diff_reversed (int diff, bool reversed)
- return reversed ? (diff < 0) - (diff > 0) : diff;
+@@ -2681,11 +3043,87 @@ diff_reversed (int diff, bool reversed)
+ return reversed ? _GL_CMP (0, diff) : diff;
}
+#if HAVE_MBRTOWC
@@ -3324,7 +2923,7 @@ Index: coreutils-9.5/src/sort.c
{
struct keyfield *key = keylist;
-@@ -2747,7 +3185,7 @@ keycompare (struct line const *a, struct
+@@ -2766,7 +3204,7 @@ keycompare (struct line const *a, struct
else if (key->human_numeric)
diff = human_numcompare (ta, tb);
else if (key->month)
@@ -3333,7 +2932,7 @@ Index: coreutils-9.5/src/sort.c
else if (key->random)
diff = compare_random (ta, tlena, tb, tlenb);
else if (key->version)
-@@ -2857,6 +3295,211 @@ keycompare (struct line const *a, struct
+@@ -2876,6 +3314,211 @@ keycompare (struct line const *a, struct
return diff_reversed (diff, key->reverse);
}
@@ -3545,7 +3144,7 @@ Index: coreutils-9.5/src/sort.c
/* Compare two lines A and B, returning negative, zero, or positive
depending on whether A compares less than, equal to, or greater than B. */
-@@ -2884,7 +3527,7 @@ compare (struct line const *a, struct li
+@@ -2903,7 +3546,7 @@ compare (struct line const *a, struct li
diff = - NONZERO (blen);
else if (blen == 0)
diff = 1;
@@ -3554,7 +3153,7 @@ Index: coreutils-9.5/src/sort.c
{
/* xmemcoll0 is a performance enhancement as
it will not unconditionally write '\0' after the
-@@ -4272,6 +4915,7 @@ set_ordering (char const *s, struct keyf
+@@ -4289,6 +4932,7 @@ set_ordering (char const *s, struct keyf
break;
case 'f':
key->translate = fold_toupper;
@@ -3562,7 +3161,7 @@ Index: coreutils-9.5/src/sort.c
break;
case 'g':
key->general_numeric = true;
-@@ -4351,7 +4995,7 @@ main (int argc, char **argv)
+@@ -4368,7 +5012,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE);
@@ -3571,7 +3170,7 @@ Index: coreutils-9.5/src/sort.c
hard_LC_TIME = hard_locale (LC_TIME);
#endif
-@@ -4374,6 +5018,29 @@ main (int argc, char **argv)
+@@ -4391,6 +5035,29 @@ main (int argc, char **argv)
thousands_sep = NON_CHAR;
}
@@ -3601,7 +3200,7 @@ Index: coreutils-9.5/src/sort.c
have_read_stdin = false;
inittables ();
-@@ -4644,13 +5311,34 @@ main (int argc, char **argv)
+@@ -4661,13 +5328,34 @@ main (int argc, char **argv)
case 't':
{
@@ -3634,13 +3233,13 @@ Index: coreutils-9.5/src/sort.c
+#endif
+ if (newtab_length == 1 && optarg[1])
{
- if (STREQ (optarg, "\\0"))
+ if (streq (optarg, "\\0"))
- newtab = '\0';
+ newtab[0] = '\0';
else
{
/* Provoke with 'sort -txx'. Complain about
-@@ -4661,9 +5349,11 @@ main (int argc, char **argv)
+@@ -4678,9 +5366,11 @@ main (int argc, char **argv)
quote (optarg));
}
}
@@ -3654,10 +3253,10 @@ Index: coreutils-9.5/src/sort.c
}
break;
-Index: coreutils-9.5/src/unexpand.c
+Index: src/unexpand.c
===================================================================
---- coreutils-9.5.orig/src/unexpand.c
-+++ coreutils-9.5/src/unexpand.c
+--- src/unexpand.c.orig
++++ src/unexpand.c
@@ -39,6 +39,9 @@
#include
#include
@@ -3668,7 +3267,7 @@ Index: coreutils-9.5/src/unexpand.c
#include "system.h"
#include "expand-common.h"
-@@ -105,24 +108,47 @@ unexpand (void)
+@@ -105,24 +108,46 @@ unexpand (void)
{
/* Input stream. */
FILE *fp = next_file (nullptr);
@@ -3688,28 +3287,27 @@ Index: coreutils-9.5/src/unexpand.c
if (!fp)
return;
+
+ mbf_init (mbf, fp);
+ found_bom=check_bom(fp,&mbf);
-
-+ if (using_utf_locale == false && found_bom == true)
-+ {
-+ /*try using some predefined locale */
+
-+ if (set_utf_locale () != 0)
++ if (using_utf_locale == false && found_bom == true)
+ {
-+ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale"));
++ /* Try using some predefined locale */
++ if (set_utf_locale () != 0)
++ {
++ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale"));
++ }
+ }
-+ }
++
/* The worst case is a non-blank character, then one blank, then a
tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
-- pending_blank = xmalloc (max_column_width);
-+ pending_blank = xmalloc (max_column_width * sizeof (mbf_char_t));
+- pending_blank = ximalloc (max_column_width);
++ pending_blank = ximalloc (max_column_width * sizeof (mbf_char_t));
+
+ if (found_bom == true)
-+ {
+ print_bom();
-+ }
while (true)
{
@@ -3719,7 +3317,7 @@ Index: coreutils-9.5/src/unexpand.c
/* If true, perform translations. */
bool convert = true;
-@@ -156,12 +182,44 @@ unexpand (void)
+@@ -156,12 +181,44 @@ unexpand (void)
do
{
@@ -3767,10 +3365,10 @@ Index: coreutils-9.5/src/unexpand.c
if (blank)
{
-@@ -178,16 +236,16 @@ unexpand (void)
- if (next_tab_column < column)
- error (EXIT_FAILURE, 0, _("input line is too long"));
+@@ -175,16 +232,16 @@ unexpand (void)
+ if (convert)
+ {
- if (c == '\t')
+ if (mb_iseq (c, '\t'))
{
@@ -3787,7 +3385,7 @@ Index: coreutils-9.5/src/unexpand.c
if (! (prev_blank && column == next_tab_column))
{
-@@ -195,13 +253,14 @@ unexpand (void)
+@@ -192,13 +249,14 @@ unexpand (void)
will be replaced by tabs. */
if (column == next_tab_column)
one_blank_before_tab_stop = true;
@@ -3804,7 +3402,7 @@ Index: coreutils-9.5/src/unexpand.c
}
/* Discard pending blanks, unless it was a single
-@@ -209,7 +268,7 @@ unexpand (void)
+@@ -206,7 +264,7 @@ unexpand (void)
pending = one_blank_before_tab_stop;
}
}
@@ -3813,7 +3411,7 @@ Index: coreutils-9.5/src/unexpand.c
{
/* Go back one column, and force recalculation of the
next tab stop. */
-@@ -219,16 +278,20 @@ unexpand (void)
+@@ -216,16 +274,20 @@ unexpand (void)
}
else
{
@@ -3838,7 +3436,7 @@ Index: coreutils-9.5/src/unexpand.c
write_error ();
pending = 0;
one_blank_before_tab_stop = false;
-@@ -238,16 +301,17 @@ unexpand (void)
+@@ -235,16 +297,17 @@ unexpand (void)
convert &= convert_entire_line || blank;
}
@@ -3859,10 +3457,10 @@ Index: coreutils-9.5/src/unexpand.c
}
}
-Index: coreutils-9.5/tests/Coreutils.pm
+Index: tests/Coreutils.pm
===================================================================
---- coreutils-9.5.orig/tests/Coreutils.pm
-+++ coreutils-9.5/tests/Coreutils.pm
+--- tests/Coreutils.pm.orig
++++ tests/Coreutils.pm
@@ -269,6 +269,9 @@ sub run_tests ($$$$$)
# Yes, this is an arbitrary limit. If it causes trouble,
# consider removing it.
@@ -3873,10 +3471,10 @@ Index: coreutils-9.5/tests/Coreutils.pm
if ($max < length $test_name)
{
warn "$program_name: $test_name: test name is too long (> $max)\n";
-Index: coreutils-9.5/tests/expand/mb.sh
+Index: tests/expand/mb.sh
===================================================================
--- /dev/null
-+++ coreutils-9.5/tests/expand/mb.sh
++++ tests/expand/mb.sh
@@ -0,0 +1,183 @@
+#!/bin/sh
+
@@ -4061,10 +3659,10 @@ Index: coreutils-9.5/tests/expand/mb.sh
+compare exp out > /dev/null 2>&1 || fail=1
+
+exit $fail
-Index: coreutils-9.5/tests/i18n/sort.sh
+Index: tests/i18n/sort.sh
===================================================================
--- /dev/null
-+++ coreutils-9.5/tests/i18n/sort.sh
++++ tests/i18n/sort.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Verify sort's multi-byte support.
@@ -4095,12 +3693,12 @@ Index: coreutils-9.5/tests/i18n/sort.sh
+
+
+Exit $fail
-Index: coreutils-9.5/tests/local.mk
+Index: tests/local.mk
===================================================================
---- coreutils-9.5.orig/tests/local.mk
-+++ coreutils-9.5/tests/local.mk
-@@ -387,6 +387,8 @@ all_tests = \
- tests/sort/sort-discrim.sh \
+--- tests/local.mk.orig
++++ tests/local.mk
+@@ -404,6 +404,8 @@ all_tests = \
+ tests/sort/sort-field-limit.sh \
tests/sort/sort-files0-from.pl \
tests/sort/sort-float.sh \
+ tests/misc/sort-mb-tests.sh \
@@ -4108,7 +3706,7 @@ Index: coreutils-9.5/tests/local.mk
tests/sort/sort-h-thousands-sep.sh \
tests/sort/sort-merge.pl \
tests/sort/sort-merge-fdlimit.sh \
-@@ -590,6 +592,7 @@ all_tests = \
+@@ -609,6 +611,7 @@ all_tests = \
tests/du/threshold.sh \
tests/du/trailing-slash.sh \
tests/du/two-args.sh \
@@ -4116,7 +3714,7 @@ Index: coreutils-9.5/tests/local.mk
tests/id/gnu-zero-uids.sh \
tests/id/no-context.sh \
tests/id/context.sh \
-@@ -746,6 +749,7 @@ all_tests = \
+@@ -765,6 +768,7 @@ all_tests = \
tests/touch/read-only.sh \
tests/touch/relative.sh \
tests/touch/trailing-slash.sh \
@@ -4124,10 +3722,10 @@ Index: coreutils-9.5/tests/local.mk
$(all_root_tests)
# See tests/factor/create-test.sh.
-Index: coreutils-9.5/tests/misc/expand.pl
+Index: tests/misc/expand.pl
===================================================================
---- coreutils-9.5.orig/tests/misc/expand.pl
-+++ coreutils-9.5/tests/misc/expand.pl
+--- tests/misc/expand.pl.orig
++++ tests/misc/expand.pl
@@ -27,6 +27,15 @@ my $prog = 'expand';
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
@@ -4191,83 +3789,10 @@ Index: coreutils-9.5/tests/misc/expand.pl
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-Index: coreutils-9.5/tests/misc/fold.pl
-===================================================================
---- coreutils-9.5.orig/tests/misc/fold.pl
-+++ coreutils-9.5/tests/misc/fold.pl
-@@ -20,9 +20,18 @@ use strict;
-
- (my $program_name = $0) =~ s|.*/||;
-
-+my $prog = 'fold';
-+my $try = "Try \`$prog --help' for more information.\n";
-+my $inval = "$prog: invalid byte, character or field list\n$try";
-+
- # Turn off localization of executable's output.
- @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
-
-+# uncommented to enable multibyte paths
-+my $mb_locale = $ENV{LOCALE_FR_UTF8};
-+! defined $mb_locale || $mb_locale eq 'none'
-+ and $mb_locale = 'C';
-+
- my @Tests =
- (
- ['s1', '-w2 -s', {IN=>"a\t"}, {OUT=>"a\n\t"}],
-@@ -31,9 +40,48 @@ my @Tests =
- ['s4', '-w4 -s', {IN=>"abc ef\n"}, {OUT=>"abc \nef\n"}],
- );
-
-+# Add _POSIX2_VERSION=199209 to the environment of each test
-+# that uses an old-style option like +1.
-+if ($mb_locale ne 'C')
-+ {
-+ # Duplicate each test vector, appending "-mb" to the test name and
-+ # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we
-+ # provide coverage for the distro-added multi-byte code paths.
-+ my @new;
-+ foreach my $t (@Tests)
-+ {
-+ my @new_t = @$t;
-+ my $test_name = shift @new_t;
-+
-+ # Depending on whether fold is multi-byte-patched,
-+ # it emits different diagnostics:
-+ # non-MB: invalid byte or field list
-+ # MB: invalid byte, character or field list
-+ # Adjust the expected error output accordingly.
-+ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval}
-+ (@new_t))
-+ {
-+ my $sub = {ERR_SUBST => 's/, character//'};
-+ push @new_t, $sub;
-+ push @$t, $sub;
-+ }
-+ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
-+ }
-+ push @Tests, @new;
-+ }
-+
-+@Tests = triple_test \@Tests;
-+
-+# Remember that triple_test creates from each test with exactly one "IN"
-+# file two more tests (.p and .r suffix on name) corresponding to reading
-+# input from a file and from a pipe. The pipe-reading test would fail
-+# due to a race condition about 1 in 20 times.
-+# Remove the IN_PIPE version of the "output-is-input" test above.
-+# The others aren't susceptible because they have three inputs each.
-+@Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests;
-+
- my $save_temps = $ENV{DEBUG};
- my $verbose = $ENV{VERBOSE};
-
--my $prog = 'fold';
- my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
- exit $fail;
-Index: coreutils-9.5/tests/misc/sort-mb-tests.sh
+Index: tests/misc/sort-mb-tests.sh
===================================================================
--- /dev/null
-+++ coreutils-9.5/tests/misc/sort-mb-tests.sh
++++ tests/misc/sort-mb-tests.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Verify sort's multi-byte support.
@@ -4314,10 +3839,10 @@ Index: coreutils-9.5/tests/misc/sort-mb-tests.sh
+compare exp out || { fail=1; cat out; }
+
+Exit $fail
-Index: coreutils-9.5/tests/misc/unexpand.pl
+Index: tests/misc/unexpand.pl
===================================================================
---- coreutils-9.5.orig/tests/misc/unexpand.pl
-+++ coreutils-9.5/tests/misc/unexpand.pl
+--- tests/misc/unexpand.pl.orig
++++ tests/misc/unexpand.pl
@@ -27,6 +27,14 @@ my $limits = getlimits ();
my $prog = 'unexpand';
@@ -4371,10 +3896,10 @@ Index: coreutils-9.5/tests/misc/unexpand.pl
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-Index: coreutils-9.5/tests/pr/pr-tests.pl
+Index: tests/pr/pr-tests.pl
===================================================================
---- coreutils-9.5.orig/tests/pr/pr-tests.pl
-+++ coreutils-9.5/tests/pr/pr-tests.pl
+--- tests/pr/pr-tests.pl.orig
++++ tests/pr/pr-tests.pl
@@ -24,6 +24,15 @@ use strict;
my $prog = 'pr';
my $normalize_strerror = "s/': .*/'/";
@@ -4440,10 +3965,10 @@ Index: coreutils-9.5/tests/pr/pr-tests.pl
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-Index: coreutils-9.5/tests/sort/sort-merge.pl
+Index: tests/sort/sort-merge.pl
===================================================================
---- coreutils-9.5.orig/tests/sort/sort-merge.pl
-+++ coreutils-9.5/tests/sort/sort-merge.pl
+--- tests/sort/sort-merge.pl.orig
++++ tests/sort/sort-merge.pl
@@ -26,6 +26,15 @@ my $prog = 'sort';
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
@@ -4500,10 +4025,10 @@ Index: coreutils-9.5/tests/sort/sort-merge.pl
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-Index: coreutils-9.5/tests/sort/sort.pl
+Index: tests/sort/sort.pl
===================================================================
---- coreutils-9.5.orig/tests/sort/sort.pl
-+++ coreutils-9.5/tests/sort/sort.pl
+--- tests/sort/sort.pl.orig
++++ tests/sort/sort.pl
@@ -24,10 +24,15 @@ my $prog = 'sort';
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
@@ -4521,7 +4046,7 @@ Index: coreutils-9.5/tests/sort/sort.pl
# Since each test is run with a file name and with redirected stdin,
# the name in the diagnostic is either the file name or "-".
# Normalize each diagnostic to use '-'.
-@@ -423,6 +428,38 @@ foreach my $t (@Tests)
+@@ -428,6 +433,38 @@ foreach my $t (@Tests)
}
}
@@ -4560,7 +4085,7 @@ Index: coreutils-9.5/tests/sort/sort.pl
@Tests = triple_test \@Tests;
# Remember that triple_test creates from each test with exactly one "IN"
-@@ -432,6 +469,7 @@ foreach my $t (@Tests)
+@@ -437,6 +474,7 @@ foreach my $t (@Tests)
# Remove the IN_PIPE version of the "output-is-input" test above.
# The others aren't susceptible because they have three inputs each.
@Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests;
@@ -4568,10 +4093,10 @@ Index: coreutils-9.5/tests/sort/sort.pl
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
-Index: coreutils-9.5/tests/unexpand/mb.sh
+Index: tests/unexpand/mb.sh
===================================================================
--- /dev/null
-+++ coreutils-9.5/tests/unexpand/mb.sh
++++ tests/unexpand/mb.sh
@@ -0,0 +1,172 @@
+#!/bin/sh
+
@@ -4745,427 +4270,3 @@ Index: coreutils-9.5/tests/unexpand/mb.sh
+
+LC_ALL=C unexpand in in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
-Index: coreutils-9.5/lib/mbchar.c
-===================================================================
---- /dev/null
-+++ coreutils-9.5/lib/mbchar.c
-@@ -0,0 +1,23 @@
-+/* Copyright (C) 2001, 2006, 2009-2024 Free Software Foundation, Inc.
-+
-+ This file is free software: you can redistribute it and/or modify
-+ it under the terms of the GNU Lesser General Public License as
-+ published by the Free Software Foundation; either version 2.1 of the
-+ License, or (at your option) any later version.
-+
-+ This file is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public License
-+ along with this program. If not, see . */
-+
-+
-+#include
-+
-+#define MBCHAR_INLINE _GL_EXTERN_INLINE
-+
-+#include
-+
-+#include "mbchar.h"
-Index: coreutils-9.5/lib/mbchar.h
-===================================================================
---- /dev/null
-+++ coreutils-9.5/lib/mbchar.h
-@@ -0,0 +1,373 @@
-+/* Multibyte character data type.
-+ Copyright (C) 2001, 2005-2007, 2009-2024 Free Software Foundation, Inc.
-+
-+ This file is free software: you can redistribute it and/or modify
-+ it under the terms of the GNU Lesser General Public License as
-+ published by the Free Software Foundation; either version 2.1 of the
-+ License, or (at your option) any later version.
-+
-+ This file is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public License
-+ along with this program. If not, see . */
-+
-+/* Written by Bruno Haible . */
-+
-+/* A multibyte character is a short subsequence of a char* string,
-+ representing a single 32-bit wide character.
-+
-+ We use multibyte characters instead of 32-bit wide characters because
-+ of the following goals:
-+ 1) correct multibyte handling, i.e. operate according to the LC_CTYPE
-+ locale,
-+ 2) ease of maintenance, i.e. the maintainer needs not know all details
-+ of the ISO C 99 standard,
-+ 3) don't fail grossly if the input is not in the encoding set by the
-+ locale, because often different encodings are in use in the same
-+ countries (ISO-8859-1/UTF-8, EUC-JP/Shift_JIS, ...),
-+ 4) fast in the case of ASCII characters.
-+
-+ Multibyte characters are only accessed through the mb* macros.
-+
-+ mb_ptr (mbc)
-+ return a pointer to the beginning of the multibyte sequence.
-+
-+ mb_len (mbc)
-+ returns the number of bytes occupied by the multibyte sequence.
-+ Always > 0.
-+
-+ mb_iseq (mbc, sc)
-+ returns true if mbc is the standard ASCII character sc.
-+
-+ mb_isnul (mbc)
-+ returns true if mbc is the nul character.
-+
-+ mb_cmp (mbc1, mbc2)
-+ returns a positive, zero, or negative value depending on whether mbc1
-+ sorts after, same or before mbc2.
-+
-+ mb_casecmp (mbc1, mbc2)
-+ returns a positive, zero, or negative value depending on whether mbc1
-+ sorts after, same or before mbc2, modulo upper/lowercase conversion.
-+
-+ mb_equal (mbc1, mbc2)
-+ returns true if mbc1 and mbc2 are equal.
-+
-+ mb_caseequal (mbc1, mbc2)
-+ returns true if mbc1 and mbc2 are equal modulo upper/lowercase conversion.
-+
-+ mb_isalnum (mbc)
-+ returns true if mbc is alphanumeric.
-+
-+ mb_isalpha (mbc)
-+ returns true if mbc is alphabetic.
-+
-+ mb_isascii(mbc)
-+ returns true if mbc is plain ASCII.
-+
-+ mb_isblank (mbc)
-+ returns true if mbc is a blank.
-+
-+ mb_iscntrl (mbc)
-+ returns true if mbc is a control character.
-+
-+ mb_isdigit (mbc)
-+ returns true if mbc is a decimal digit.
-+
-+ mb_isgraph (mbc)
-+ returns true if mbc is a graphic character.
-+
-+ mb_islower (mbc)
-+ returns true if mbc is lowercase.
-+
-+ mb_isprint (mbc)
-+ returns true if mbc is a printable character.
-+
-+ mb_ispunct (mbc)
-+ returns true if mbc is a punctuation character.
-+
-+ mb_isspace (mbc)
-+ returns true if mbc is a space character.
-+
-+ mb_isupper (mbc)
-+ returns true if mbc is uppercase.
-+
-+ mb_isxdigit (mbc)
-+ returns true if mbc is a hexadecimal digit.
-+
-+ mb_width (mbc)
-+ returns the number of columns on the output device occupied by mbc.
-+ Always >= 0.
-+
-+ mb_putc (mbc, stream)
-+ outputs mbc on stream, a byte oriented FILE stream opened for output.
-+
-+ mb_setascii (&mbc, sc)
-+ assigns the standard ASCII character sc to mbc.
-+ (Only available if the 'mbfile' module is in use.)
-+
-+ mb_copy (&destmbc, &srcmbc)
-+ copies srcmbc to destmbc.
-+
-+ Here are the function prototypes of the macros.
-+
-+ extern const char * mb_ptr (const mbchar_t mbc);
-+ extern size_t mb_len (const mbchar_t mbc);
-+ extern bool mb_iseq (const mbchar_t mbc, char sc);
-+ extern bool mb_isnul (const mbchar_t mbc);
-+ extern int mb_cmp (const mbchar_t mbc1, const mbchar_t mbc2);
-+ extern int mb_casecmp (const mbchar_t mbc1, const mbchar_t mbc2);
-+ extern bool mb_equal (const mbchar_t mbc1, const mbchar_t mbc2);
-+ extern bool mb_caseequal (const mbchar_t mbc1, const mbchar_t mbc2);
-+ extern bool mb_isalnum (const mbchar_t mbc);
-+ extern bool mb_isalpha (const mbchar_t mbc);
-+ extern bool mb_isascii (const mbchar_t mbc);
-+ extern bool mb_isblank (const mbchar_t mbc);
-+ extern bool mb_iscntrl (const mbchar_t mbc);
-+ extern bool mb_isdigit (const mbchar_t mbc);
-+ extern bool mb_isgraph (const mbchar_t mbc);
-+ extern bool mb_islower (const mbchar_t mbc);
-+ extern bool mb_isprint (const mbchar_t mbc);
-+ extern bool mb_ispunct (const mbchar_t mbc);
-+ extern bool mb_isspace (const mbchar_t mbc);
-+ extern bool mb_isupper (const mbchar_t mbc);
-+ extern bool mb_isxdigit (const mbchar_t mbc);
-+ extern int mb_width (const mbchar_t mbc);
-+ extern void mb_putc (const mbchar_t mbc, FILE *stream);
-+ extern void mb_setascii (mbchar_t *new, char sc);
-+ extern void mb_copy (mbchar_t *new, const mbchar_t *old);
-+ */
-+
-+#ifndef _MBCHAR_H
-+#define _MBCHAR_H 1
-+
-+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE. */
-+#if !_GL_CONFIG_H_INCLUDED
-+ #error "Please include config.h first."
-+#endif
-+
-+#include
-+#include
-+
-+_GL_INLINE_HEADER_BEGIN
-+#ifndef MBCHAR_INLINE
-+# define MBCHAR_INLINE _GL_INLINE
-+#endif
-+
-+/* The longest multibyte characters, nowadays, are 4 bytes long.
-+ Regardless of the values of MB_CUR_MAX and MB_LEN_MAX. */
-+#define MBCHAR_BUF_SIZE 4
-+
-+struct mbchar
-+{
-+ const char *ptr; /* pointer to current character */
-+ size_t bytes; /* number of bytes of current character, > 0 */
-+ bool wc_valid; /* true if wc is a valid 32-bit wide character */
-+ char32_t wc; /* if wc_valid: the current character */
-+#if defined GNULIB_MBFILE
-+ char buf[MBCHAR_BUF_SIZE]; /* room for the bytes, used for file input only */
-+#endif
-+};
-+
-+/* EOF (not a real character) is represented with bytes = 0 and
-+ wc_valid = false. */
-+
-+typedef struct mbchar mbchar_t;
-+
-+/* Access the current character. */
-+#define mb_ptr(mbc) ((mbc).ptr)
-+#define mb_len(mbc) ((mbc).bytes)
-+
-+/* Comparison of characters. */
-+#define mb_iseq(mbc, sc) ((mbc).wc_valid && (mbc).wc == (sc))
-+#define mb_isnul(mbc) ((mbc).wc_valid && (mbc).wc == 0)
-+#define mb_cmp(mbc1, mbc2) \
-+ ((mbc1).wc_valid \
-+ ? ((mbc2).wc_valid \
-+ ? _GL_CMP ((mbc1).wc, (mbc2).wc) \
-+ : -1) \
-+ : ((mbc2).wc_valid \
-+ ? 1 \
-+ : (mbc1).bytes == (mbc2).bytes \
-+ ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \
-+ : (mbc1).bytes < (mbc2).bytes \
-+ ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \
-+ : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1)))
-+#define mb_casecmp(mbc1, mbc2) \
-+ ((mbc1).wc_valid \
-+ ? ((mbc2).wc_valid \
-+ ? _GL_CMP (c32tolower ((mbc1).wc), c32tolower ((mbc2).wc)) \
-+ : -1) \
-+ : ((mbc2).wc_valid \
-+ ? 1 \
-+ : (mbc1).bytes == (mbc2).bytes \
-+ ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \
-+ : (mbc1).bytes < (mbc2).bytes \
-+ ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \
-+ : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1)))
-+#define mb_equal(mbc1, mbc2) \
-+ ((mbc1).wc_valid && (mbc2).wc_valid \
-+ ? (mbc1).wc == (mbc2).wc \
-+ : (mbc1).bytes == (mbc2).bytes \
-+ && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0)
-+#define mb_caseequal(mbc1, mbc2) \
-+ ((mbc1).wc_valid && (mbc2).wc_valid \
-+ ? c32tolower ((mbc1).wc) == c32tolower ((mbc2).wc) \
-+ : (mbc1).bytes == (mbc2).bytes \
-+ && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0)
-+
-+/* , classification. */
-+#define mb_isascii(mbc) \
-+ ((mbc).wc_valid && (mbc).wc >= 0 && (mbc).wc <= 127)
-+#define mb_isalnum(mbc) ((mbc).wc_valid && c32isalnum ((mbc).wc))
-+#define mb_isalpha(mbc) ((mbc).wc_valid && c32isalpha ((mbc).wc))
-+#define mb_isblank(mbc) ((mbc).wc_valid && c32isblank ((mbc).wc))
-+#define mb_iscntrl(mbc) ((mbc).wc_valid && c32iscntrl ((mbc).wc))
-+#define mb_isdigit(mbc) ((mbc).wc_valid && c32isdigit ((mbc).wc))
-+#define mb_isgraph(mbc) ((mbc).wc_valid && c32isgraph ((mbc).wc))
-+#define mb_islower(mbc) ((mbc).wc_valid && c32islower ((mbc).wc))
-+#define mb_isprint(mbc) ((mbc).wc_valid && c32isprint ((mbc).wc))
-+#define mb_ispunct(mbc) ((mbc).wc_valid && c32ispunct ((mbc).wc))
-+#define mb_isspace(mbc) ((mbc).wc_valid && c32isspace ((mbc).wc))
-+#define mb_isupper(mbc) ((mbc).wc_valid && c32isupper ((mbc).wc))
-+#define mb_isxdigit(mbc) ((mbc).wc_valid && c32isxdigit ((mbc).wc))
-+
-+/* Extra function. */
-+
-+/* Unprintable characters appear as a small box of width 1. */
-+#define MB_UNPRINTABLE_WIDTH 1
-+
-+MBCHAR_INLINE int
-+mb_width_aux (char32_t wc)
-+{
-+ int w = c32width (wc);
-+ /* For unprintable characters, arbitrarily return 0 for control characters
-+ and MB_UNPRINTABLE_WIDTH otherwise. */
-+ return (w >= 0 ? w : c32iscntrl (wc) ? 0 : MB_UNPRINTABLE_WIDTH);
-+}
-+
-+#define mb_width(mbc) \
-+ ((mbc).wc_valid ? mb_width_aux ((mbc).wc) : MB_UNPRINTABLE_WIDTH)
-+
-+/* Output. */
-+#define mb_putc(mbc, stream) fwrite ((mbc).ptr, 1, (mbc).bytes, (stream))
-+
-+#if defined GNULIB_MBFILE
-+/* Assignment. */
-+# define mb_setascii(mbc, sc) \
-+ ((mbc)->ptr = (mbc)->buf, (mbc)->bytes = 1, (mbc)->wc_valid = 1, \
-+ (mbc)->wc = (mbc)->buf[0] = (sc))
-+#endif
-+
-+/* Copying a character. */
-+MBCHAR_INLINE void
-+mb_copy (mbchar_t *new_mbc, const mbchar_t *old_mbc)
-+{
-+#if defined GNULIB_MBFILE
-+ if (old_mbc->ptr == &old_mbc->buf[0])
-+ {
-+ memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes);
-+ new_mbc->ptr = &new_mbc->buf[0];
-+ }
-+ else
-+#endif
-+ new_mbc->ptr = old_mbc->ptr;
-+ new_mbc->bytes = old_mbc->bytes;
-+ if ((new_mbc->wc_valid = old_mbc->wc_valid))
-+ new_mbc->wc = old_mbc->wc;
-+}
-+
-+
-+/* is_basic(c) tests whether the single-byte character c is
-+ - in the ISO C "basic character set" or is one of '@', '$', and '`'
-+ which ISO C 23 § 5.2.1.1.(1) guarantees to be single-byte and in
-+ practice are safe to treat as basic in the execution character set,
-+ or
-+ - in the POSIX "portable character set", which
-+
-+ equally guarantees to be single-byte.
-+ This is a convenience function, and is in this file only to share code
-+ between mbiter.h, mbuiter.h, and mbfile.h. */
-+#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
-+ && ('$' == 36) && ('%' == 37) && ('&' == 38) && ('\'' == 39) \
-+ && ('(' == 40) && (')' == 41) && ('*' == 42) && ('+' == 43) \
-+ && (',' == 44) && ('-' == 45) && ('.' == 46) && ('/' == 47) \
-+ && ('0' == 48) && ('1' == 49) && ('2' == 50) && ('3' == 51) \
-+ && ('4' == 52) && ('5' == 53) && ('6' == 54) && ('7' == 55) \
-+ && ('8' == 56) && ('9' == 57) && (':' == 58) && (';' == 59) \
-+ && ('<' == 60) && ('=' == 61) && ('>' == 62) && ('?' == 63) \
-+ && ('@' == 64) && ('A' == 65) && ('B' == 66) && ('C' == 67) \
-+ && ('D' == 68) && ('E' == 69) && ('F' == 70) && ('G' == 71) \
-+ && ('H' == 72) && ('I' == 73) && ('J' == 74) && ('K' == 75) \
-+ && ('L' == 76) && ('M' == 77) && ('N' == 78) && ('O' == 79) \
-+ && ('P' == 80) && ('Q' == 81) && ('R' == 82) && ('S' == 83) \
-+ && ('T' == 84) && ('U' == 85) && ('V' == 86) && ('W' == 87) \
-+ && ('X' == 88) && ('Y' == 89) && ('Z' == 90) && ('[' == 91) \
-+ && ('\\' == 92) && (']' == 93) && ('^' == 94) && ('_' == 95) \
-+ && ('`' == 96) && ('a' == 97) && ('b' == 98) && ('c' == 99) \
-+ && ('d' == 100) && ('e' == 101) && ('f' == 102) && ('g' == 103) \
-+ && ('h' == 104) && ('i' == 105) && ('j' == 106) && ('k' == 107) \
-+ && ('l' == 108) && ('m' == 109) && ('n' == 110) && ('o' == 111) \
-+ && ('p' == 112) && ('q' == 113) && ('r' == 114) && ('s' == 115) \
-+ && ('t' == 116) && ('u' == 117) && ('v' == 118) && ('w' == 119) \
-+ && ('x' == 120) && ('y' == 121) && ('z' == 122) && ('{' == 123) \
-+ && ('|' == 124) && ('}' == 125) && ('~' == 126)
-+/* The character set is ISO-646, not EBCDIC. */
-+# define IS_BASIC_ASCII 1
-+
-+/* All locale encodings (see localcharset.h) map the characters 0x00..0x7F
-+ to U+0000..U+007F, like ASCII, except for
-+ CP864 different mapping of '%'
-+ SHIFT_JIS different mappings of 0x5C, 0x7E
-+ JOHAB different mapping of 0x5C
-+ However, these characters in the range 0x20..0x7E are in the ISO C
-+ "basic character set" and in the POSIX "portable character set", which
-+ ISO C and POSIX guarantee to be single-byte. Thus, locales with these
-+ encodings are not POSIX compliant. And they are most likely not in use
-+ any more (as of 2023). */
-+# define is_basic(c) ((unsigned char) (c) < 0x80)
-+
-+#else
-+
-+MBCHAR_INLINE bool
-+is_basic (char c)
-+{
-+ switch (c)
-+ {
-+ case '\0':
-+ case '\007': case '\010':
-+ case '\t': case '\n': case '\v': case '\f': case '\r':
-+ case ' ': case '!': case '"': case '#': case '$': case '%':
-+ case '&': case '\'': case '(': case ')': case '*':
-+ case '+': case ',': case '-': case '.': case '/':
-+ case '0': case '1': case '2': case '3': case '4':
-+ case '5': case '6': case '7': case '8': case '9':
-+ case ':': case ';': case '<': case '=': case '>':
-+ case '?': case '@':
-+ case 'A': case 'B': case 'C': case 'D': case 'E':
-+ case 'F': case 'G': case 'H': case 'I': case 'J':
-+ case 'K': case 'L': case 'M': case 'N': case 'O':
-+ case 'P': case 'Q': case 'R': case 'S': case 'T':
-+ case 'U': case 'V': case 'W': case 'X': case 'Y':
-+ case 'Z':
-+ case '[': case '\\': case ']': case '^': case '_': case '`':
-+ case 'a': case 'b': case 'c': case 'd': case 'e':
-+ case 'f': case 'g': case 'h': case 'i': case 'j':
-+ case 'k': case 'l': case 'm': case 'n': case 'o':
-+ case 'p': case 'q': case 'r': case 's': case 't':
-+ case 'u': case 'v': case 'w': case 'x': case 'y':
-+ case 'z': case '{': case '|': case '}': case '~':
-+ return 1;
-+ default:
-+ return 0;
-+ }
-+}
-+
-+#endif
-+
-+_GL_INLINE_HEADER_END
-+
-+#endif /* _MBCHAR_H */
-Index: coreutils-9.5/m4/mbchar.m4
-===================================================================
---- /dev/null
-+++ coreutils-9.5/m4/mbchar.m4
-@@ -0,0 +1,13 @@
-+# mbchar.m4 serial 9
-+dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc.
-+dnl This file is free software; the Free Software Foundation
-+dnl gives unlimited permission to copy and/or distribute it,
-+dnl with or without modifications, as long as this notice is preserved.
-+
-+dnl autoconf tests required for use of mbchar.m4
-+dnl From Bruno Haible.
-+
-+AC_DEFUN([gl_MBCHAR],
-+[
-+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-+])
diff --git a/coreutils-remove_hostname_documentation.patch b/coreutils-remove_hostname_documentation.patch
index 75fef4f..0b5cc41 100644
--- a/coreutils-remove_hostname_documentation.patch
+++ b/coreutils-remove_hostname_documentation.patch
@@ -6,7 +6,7 @@ Index: doc/coreutils.texi
===================================================================
--- doc/coreutils.texi.orig
+++ doc/coreutils.texi
-@@ -73,7 +73,6 @@
+@@ -69,7 +69,6 @@
* groups: (coreutils)groups invocation. Print group names a user is in.
* head: (coreutils)head invocation. Output the first part of files.
* hostid: (coreutils)hostid invocation. Print numeric host identifier.
@@ -14,7 +14,7 @@ Index: doc/coreutils.texi
* id: (coreutils)id invocation. Print user identity.
* install: (coreutils)install invocation. Copy files and set attributes.
* join: (coreutils)join invocation. Join lines on a common field.
-@@ -206,7 +205,7 @@ Free Documentation License''.
+@@ -202,7 +201,7 @@ Free Documentation License''.
* File name manipulation:: dirname basename pathchk mktemp realpath
* Working context:: pwd stty printenv tty
* User information:: id logname whoami groups users who
@@ -23,7 +23,7 @@ Index: doc/coreutils.texi
* SELinux context:: chcon runcon
* Modified command invocation:: chroot env nice nohup stdbuf timeout
* Process control:: kill
-@@ -430,7 +429,6 @@ System context
+@@ -427,7 +426,6 @@ System context
* date invocation:: Print or set system date and time
* nproc invocation:: Print the number of processors
* uname invocation:: Print system information
@@ -31,7 +31,7 @@ Index: doc/coreutils.texi
* hostid invocation:: Print numeric host identifier
* uptime invocation:: Print system uptime and load
-@@ -16421,7 +16419,6 @@ information.
+@@ -16600,7 +16598,6 @@ information.
* arch invocation:: Print machine hardware name.
* nproc invocation:: Print the number of processors.
* uname invocation:: Print system information.
@@ -39,7 +39,7 @@ Index: doc/coreutils.texi
* hostid invocation:: Print numeric host identifier.
* uptime invocation:: Print system uptime and load.
@end menu
-@@ -17329,15 +17326,6 @@ This is non-portable, even across GNU/Li
+@@ -17600,15 +17597,6 @@ This is non-portable, even across GNU/Li
Print the machine hardware name (sometimes called the hardware class
or hardware type).
@@ -55,7 +55,7 @@ Index: doc/coreutils.texi
@item -p
@itemx --processor
@opindex -p
-@@ -17391,34 +17379,6 @@ Print the kernel version.
+@@ -17662,34 +17650,6 @@ Print the kernel version.
@exitstatus
diff --git a/coreutils-remove_kill_documentation.patch b/coreutils-remove_kill_documentation.patch
index ba300f7..9bf8bc3 100644
--- a/coreutils-remove_kill_documentation.patch
+++ b/coreutils-remove_kill_documentation.patch
@@ -6,7 +6,7 @@ Index: doc/coreutils.texi
===================================================================
--- doc/coreutils.texi.orig
+++ doc/coreutils.texi
-@@ -76,7 +76,6 @@
+@@ -72,7 +72,6 @@
* id: (coreutils)id invocation. Print user identity.
* install: (coreutils)install invocation. Copy files and set attributes.
* join: (coreutils)join invocation. Join lines on a common field.
@@ -14,7 +14,7 @@ Index: doc/coreutils.texi
* link: (coreutils)link invocation. Make hard links between files.
* ln: (coreutils)ln invocation. Make links between files.
* logname: (coreutils)logname invocation. Print current login name.
-@@ -208,7 +207,6 @@ Free Documentation License''.
+@@ -204,7 +203,6 @@ Free Documentation License''.
* System context:: date arch nproc uname hostid uptime
* SELinux context:: chcon runcon
* Modified command invocation:: chroot env nice nohup stdbuf timeout
@@ -22,7 +22,7 @@ Index: doc/coreutils.texi
* Delaying:: sleep
* Numeric operations:: factor numfmt seq
* File permissions:: Access modes
-@@ -457,10 +455,6 @@ Modified command invocation
+@@ -454,10 +452,6 @@ Modified command invocation
* stdbuf invocation:: Run a command with modified I/O buffering
* timeout invocation:: Run a command with a time limit
@@ -33,7 +33,7 @@ Index: doc/coreutils.texi
Delaying
* sleep invocation:: Delay for a specified time
-@@ -18848,90 +18842,6 @@ timeout -s INT 5s env --ignore-signal=IN
+@@ -19127,90 +19121,6 @@ timeout -s INT 5s env --ignore-signal=IN
timeout -s INT -k 3s 5s env --ignore-signal=INT sleep 20
@end example
diff --git a/coreutils-skip-gnulib-test-tls.patch b/coreutils-skip-gnulib-test-tls.patch
index 8670699..3e23904 100644
--- a/coreutils-skip-gnulib-test-tls.patch
+++ b/coreutils-skip-gnulib-test-tls.patch
@@ -21,7 +21,7 @@ Index: gnulib-tests/gnulib.mk
===================================================================
--- gnulib-tests/gnulib.mk.orig
+++ gnulib-tests/gnulib.mk
-@@ -3299,9 +3299,10 @@ EXTRA_DIST += test-timespec.c macros.h
+@@ -3699,9 +3699,10 @@ EXTRA_DIST += test-timespec.c macros.h
## begin gnulib module tls-tests
diff --git a/coreutils-tests-shorten-extreme-factor-tests.patch b/coreutils-tests-shorten-extreme-factor-tests.patch
index 01b2063..3aa652a 100644
--- a/coreutils-tests-shorten-extreme-factor-tests.patch
+++ b/coreutils-tests-shorten-extreme-factor-tests.patch
@@ -16,7 +16,7 @@ Index: tests/local.mk
===================================================================
--- tests/local.mk.orig
+++ tests/local.mk
-@@ -755,14 +755,9 @@ all_tests = \
+@@ -774,13 +774,8 @@ all_tests = \
# See tests/factor/create-test.sh.
tf = tests/factor
factor_tests = \
@@ -27,10 +27,8 @@ Index: tests/local.mk
- $(tf)/t20.sh $(tf)/t21.sh $(tf)/t22.sh $(tf)/t23.sh $(tf)/t24.sh \
- $(tf)/t25.sh $(tf)/t26.sh $(tf)/t27.sh $(tf)/t28.sh $(tf)/t29.sh \
- $(tf)/t30.sh $(tf)/t31.sh $(tf)/t32.sh $(tf)/t33.sh $(tf)/t34.sh \
-- $(tf)/t35.sh $(tf)/t36.sh
+ $(tf)/t00.sh \
+ $(tf)/t05.sh \
-+ $(tf)/t36.sh
+ $(tf)/t35.sh $(tf)/t36.sh $(tf)/t37.sh $(tf)/t38.sh
$(factor_tests): $(tf)/run.sh $(tf)/create-test.sh
- $(AM_V_GEN)$(MKDIR_P) $(tf)
diff --git a/coreutils-tests-workaround-make-fdleak.patch b/coreutils-tests-workaround-make-fdleak.patch
index aae4084..967fd42 100644
--- a/coreutils-tests-workaround-make-fdleak.patch
+++ b/coreutils-tests-workaround-make-fdleak.patch
@@ -6,7 +6,7 @@ Index: tests/init.sh
===================================================================
--- tests/init.sh.orig
+++ tests/init.sh
-@@ -691,6 +691,16 @@ compare ()
+@@ -738,6 +738,16 @@ compare ()
}
# -----------------------------------------------------------------------------
diff --git a/coreutils.changes b/coreutils.changes
index c41b3fa..6b049cd 100644
--- a/coreutils.changes
+++ b/coreutils.changes
@@ -1,3 +1,302 @@
+-------------------------------------------------------------------
+Thu Sep 25 18:57:34 UTC 2025 - Bernhard Voelker
+
+- coreutils-9.8-tail-large-num-of-files.patch: Add upstream patch:
+ https://cgit.git.sv.gnu.org/cgit/coreutils.git/commit/?id=914972e80dbf82aac9ffe
+ tail: fix tailing larger number of lines in regular files [rh#2398008]
+
+-------------------------------------------------------------------
+Tue Sep 23 19:39:43 UTC 2025 - Bernhard Voelker
+
+- Update to 9.8:
+ Bug fixes
+ * 'b2sum' will diagnose --length values that are too big.
+ Previously it would have silently assumed 512 for any larger values.
+ [bug introduced in coreutils-9.6]
+ * 'base32' and 'base64' when decoding will again diagnose partially
+ padded data that ends with a newline.
+ [bug introduced in coreutils-9.5]
+ * 'basenc -d -i' will now strip '=' characters from the input
+ in encodings where padding characters are not valid.
+ [bug introduced with the basenc program in coreutils-8.31]
+ * 'cp -p' had spurious "Operation not supported" failures when
+ copying to non-NFS files from NFSv4 files with trivial ACLs.
+ [bug introduced in coreutils-9.6]
+ * 'cp --sparse=always' missed some opportunities to create holes.
+ That is, although the copies had the correct data, sometimes
+ data zeros used extents rather than holes.
+ [This bug was present in "the beginning".]
+ * cp missed opportunities to create holes when copying from file
+ systems like squashfs that support SEEK_HOLE only trivially.
+ [bug introduced in coreutils-9.0]
+ * cp, install, and mv now avoid possible data corruption on
+ glibc 2.41 and 2.42 systems when copy_file_range is used with ranges > 2GiB,
+ avoiding https://sourceware.org/PR33245
+ [bug triggered since coreutils-9.0]
+ * 'date' supports specifying multiple named formats with the last taking
+ precedence. Previously multiple specifications would induce an error.
+ [bug introduced in coreutils-5.90]
+ * 'dd oflag=seek_bytes' no longer mistakenly reports errors when the
+ output file exists on GNU/Hurd.
+ [bug introduced in coreutils-8.16]
+ * 'fold' no longer exhausts memory when processing large inputs
+ with a very large --width argument.
+ [This bug was present in "the beginning".]
+ * 'install -d' now produces the correct diagnostic upon failure
+ to create a directory. Previously it would have produced
+ a confusing error about changing permissions.
+ [This bug was present in "the beginning".]
+ * "ls --size --block-size=\'k" could misalign output in locales
+ with multi-byte thousands grouping characters.
+ [This bug was present in "the beginning".]
+ * 'nohup' avoids implementation defined behavior setting umask,
+ avoiding a FORTIFY runtime failure on Bionic libc.
+ [This bug was present in "the beginning".]
+ * 'od --strings' with '-N' now works correctly. Previously od might
+ write a NUL byte after a heap buffer, or output invalid addresses.
+ [These bugs were present in "the beginning".]
+ * 'od -w0' will now issue a diagnostic and exit gracefully.
+ Previously it would have aborted.
+ [bug introduced in coreutils-9.3]
+ * 'od -w' no longer silently mishandles enormous widths like 3037000500.
+ Instead, it either outputs correctly or diagnoses a too-large width.
+ [This bug was present in "the beginning".]
+ * 'od +N.' (where N is a decimal number) works again as per POSIX.
+ [bug introduced in textutils-2.0]
+ * 'od /dev/null ++0' no longer mistakenly treats the ++0 as an offset.
+ [This bug was present in "the beginning".]
+ * 'sort' with key character offsets of SIZE_MAX, could induce
+ a read of 1 byte before an allocated heap buffer. For example:
+ 'sort +0.18446744073709551615R input' on 64 bit systems.
+ [bug introduced in coreutils-7.2]
+ * stdbuf now works on AIX. Previously it would have been ineffective.
+ [bug introduced with the stdbuf program in coreutils-7.5]
+ * 'tail -n NUM' no longer can output more than NUM lines if stdin
+ is a largish regular file with a nonzero initial offset, and grows
+ while 'tail' is reading it.
+ [This bug was present in "the beginning".]
+ * 'tail -f -n +NUM' no longer mishandles NUM values >= UINTMAX_MAX
+ when the input is seekable.
+ [bug introduced in coreutils-9.6]
+ * 'tail --pid' avoids some unlikely races if the kernel reuses PIDs.
+ [bug introduced in coreutils-9.5]
+ * 'tty' now exits with status 4 with a special diagnostic if ttyname
+ fails even though standard input is a tty. Formerly it quietly
+ pretended that standard input was not a tty.
+ [This bug was present in "the beginning".]
+ New Features
+ * basenc supports the --base58 option to encode and decode
+ the visually unambiguous Base58 encoding.
+ * 'cksum -a' now supports the 'sha3' argument, to use the SHA3-224,
+ SHA3-256, SHA3-384, SHA3-512 message digest algorithms depending on
+ the argument passed to the required --length (-l) option.
+ * 'cksum -a' now supports the 'sha2' argument, as a more consistent
+ interface than the existing 'sha224', 'sha256', 'sha384', 'sha512'
+ arguments, which are now selected with the --length (-l) option.
+ * 'date' now outputs dates in the country's native calendar for the
+ Iranian locale (fa_IR) and for the Ethiopian locale (am_ET), and also
+ does so more consistently for the Thailand locale (th_TH.UTF-8).
+ * fold now supports multi-byte characters, honoring their column width.
+ Also the --characters (-c) option was added to wrap at a certain
+ number of characters, similarly to --bytes in uni-byte locales.
+ * nproc now honors any cgroup v2 configured CPU quotas,
+ which may reduce the effective number of processors available.
+ * stty supports setting arbitrary baud rates on supported systems,
+ like Hurd, Linux with glibc >= 2.42, and some BSDs.
+ Also on other systems the full set of supported baud rates
+ is determined at build time if possible.
+ * Commands that support hardware acceleration like cksum and wc
+ can now disable this acceleration at runtime through the
+ commonly used GLIBC_TUNABLES environment variable. For example
+ to disable the use of AVX512 instructions in cksum, you can:
+ export GLIBC_TUNABLES='glibc.cpu.hwcaps=-AVX512F'
+ Changes to conform better to POSIX.1-2024
+ * readlink now defaults to being verbose if the POSIXLY_CORRECT
+ environment variable is set.
+ * realpath now supports -E, which specifies the default behavior.
+ The corresponding long option is --canonicalize.
+ * tsort now accepts and ignores -w.
+ Improvements
+ * 'factor' is now much faster at identifying large prime numbers,
+ and significantly faster on composite numbers greater than 2^128.
+ * fold now exits immediately upon receiving a write error,
+ which is significant when reading large / unbounded inputs.
+ * 'seq' is more accurate with large integer start values.
+ Previously 'seq 18446744073709551617 inf | head -n1' would
+ output the number before the user specified start value.
+ Build-related
+ * cksum was not compilable by Apple LLVM 10.0.0 x86-64, which
+ lacks support for checking for the VPCLMULQDQ instruction.
+ [bug introduced in coreutils-9.6]
+- coreutils-9.7-sort-CVE-2025-5278.patch: Remove now-upstream patch.
+- coreutils-getaddrinfo.patch: Likewise.
+- coreutils-i18n.patch: Refresh patch.
+ Remove i18n part for fold(1).
+ Remove the mbchar part as it is now already pulled in upstream
+ indirectly via the manywarnings gnulib module.
+- Refresh all other patches.
+
+-------------------------------------------------------------------
+Mon Jun 2 09:30:09 UTC 2025 - rw@suse.com
+
+- coreutils-9.7-sort-CVE-2025-5278.patch: Add upstream patch:
+ sort with key character offsets of SIZE_MAX, could induce
+ a read of 1 byte before an allocated heap buffer.
+ (CVE-2025-5278, bsc#1243767)
+
+-------------------------------------------------------------------
+Sun Apr 13 18:32:55 UTC 2025 - Bernhard Voelker
+
+- coreutils-i18n.patch: update gnulib mbchar+mbfile to the commit
+ used by coreutils-9.7:
+ https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=41e7b7e0d
+ mainly to pick up these commits:
+ - c67c553e758 mbfile: Support pushback characters also right before EOF.
+ - 87ee7ef66ee mbfile: Allow 2 pushback characters.
+
+-------------------------------------------------------------------
+Thu Apr 10 20:56:23 UTC 2025 - Bernhard Voelker
+
+- Update to 9.7:
+ Bug fixes
+ * 'cat' would fail with "input file is output file" if input and
+ output are the same terminal device and the output is append-only.
+ [bug introduced in coreutils-9.6]
+ * 'cksum -a crc' misbehaved on aarch64 with 32-bit uint_fast32_t.
+ [bug introduced in coreutils-9.6]
+ * dd with the 'nocache' flag will now detect all failures to drop the
+ cache for the whole file. Previously it may have erroneously succeeded.
+ [bug introduced with the "nocache" feature in coreutils-8.11]
+ * 'ls -Z dir' would crash on all systems, and 'ls -l' could crash
+ on systems like Android with SELinux but without xattr support.
+ [bug introduced in coreutils-9.6]
+ * `ls -l` could output spurious "Not supported" errors in certain cases,
+ like with dangling symlinks on cygwin.
+ [bug introduced in coreutils-9.6]
+ * timeout would fail to timeout commands with infinitesimal timeouts.
+ For example `timeout 1e-5000 sleep inf` would never timeout.
+ [bug introduced with timeout in coreutils-7.0]
+ * sleep, tail, and timeout would sometimes sleep for slightly less
+ time than requested.
+ [bug introduced in coreutils-5.0]
+ * 'who -m' now outputs entries for remote logins. Previously login
+ entries prefixed with the service (like "sshd") were not matched.
+ [bug introduced in coreutils-9.4]
+ Improvements
+ * 'logname' correctly returns the user who logged in the session,
+ on more systems. Previously on musl or uclibc it would have merely
+ output the LOGNAME environment variable.
+- coreutils-9.6-ls-Z-crash-fix.patch: Remove now-upstream patch.
+- Refresh all other patches.
+
+-------------------------------------------------------------------
+Fri Jan 17 22:22:08 UTC 2025 - Bernhard Voelker
+
+- Update to 9.6:
+ Bug fixes
+ * cp fixes support for --update=none-fail, which would have been
+ rejected as an invalid option.
+ [bug introduced in coreutils-9.5]
+ * cp,mv --update no longer overrides --interactive or --force.
+ [bug introduced in coreutils-9.3]
+ * csplit no longer creates empty files given empty input.
+ [This bug was present in "the beginning".]
+ * ls and printf fix shell quoted output in the edge case of escaped
+ first and last characters, and single quotes in the string.
+ [bug introduced in coreutils-8.26]
+ * ls -l no longer outputs "Permission denied" errors on NFS
+ which may happen with files without read permission, and which resulted
+ in inaccurate indication of ACLs (missing '+' flag after mode).
+ [bug introduced in coreutils-9.4]
+ * ls -l no longer outputs "Not supported" errors on virtiofs.
+ [bug introduced in coreutils-9.4]
+ * mv works again with macFUSE file systems. Previously it would
+ have exited with a "Function not implemented" error.
+ [bug introduced in coreutils-8.28]
+ * nproc gives more consistent results on systems with more than 1024 CPUs.
+ Previously it would have ignored the affinity mask on such systems.
+ [bug introduced with nproc in coreutils-8.1]
+ * numfmt --from=iec-i now works with numbers without a suffix.
+ Previously such numbers were rejected with an error.
+ [bug introduced with numfmt in coreutils-8.21]
+ * printf now diagnoses attempts to treat empty strings as numbers,
+ as per POSIX. For example, "printf '%d' ''" now issues a diagnostic
+ and fails instead of silently succeeding.
+ [This bug was present in "the beginning".]
+ * pwd no longer outputs an erroneous double slash on systems
+ where the system getcwd() was completely replaced.
+ [bug introduced in coreutils-9.2]
+ * 'shuf' generates more-random output when the output is small.
+ [bug introduced in coreutils-8.6]
+ * `tail --follow=name` no longer waits indefinitely for watched
+ file names that are moved elsewhere within the same file system.
+ [bug introduced in coreutils-8.24]
+ * `tail --follow` without --retry, will consistently exit with failure status
+ where inotify is not used, when all followed files become inaccessible.
+ [This bug was present in "the beginning".]
+ * `tail --follow --pid=PID` will now exit when the PID dies,
+ even in the presence of blocking inputs like unopened fifos.
+ [This bug was present in "the beginning".]
+ * 'tail -c 4096 /dev/zero' no longer loops forever.
+ [This bug was present in "the beginning".]
+ Changes in behavior
+ * 'factor' now buffers output more efficiently in some cases.
+ * install -C now dereferences symlink sources when comparing,
+ rather than always treating as different and performing the copy.
+ * kill -l and -t now list signal 0, as it's a valid signal to send.
+ * ls's -f option now simply acts like -aU, instead of also ignoring
+ some earlier options. For example 'ls -fl' and 'ls -lf' are now
+ equivalent because -f no longer ignores an earlier -l. The new
+ behavior is more orthogonal and is compatible with FreeBSD.
+ * stat -f -c%T now reports the "fuseblk" file system type as "fuse",
+ given that there is no longer a distinct "ctl" fuse variant file system.
+ New Features
+ * cksum -a now supports the "crc32b" option, which calculates the CRC
+ of the input as defined by ITU V.42, as used by gzip for example.
+ For performance pclmul instructions are used where supported.
+ * ls now supports the --sort=name option,
+ to explicitly select the default operation of sorting by file name.
+ * printf now supports indexed arguments, using the POSIX:2024 specified
+ %$ format, where '' is an integer referencing a particular argument,
+ thus allowing repetition or reordering of printf arguments.
+ * test supports the POSIX:2024 specified '<' and '>' operators with strings,
+ to compare the string locale collating order.
+ * timeout now supports the POSIX:2024 specified -f, and -p short options,
+ corresponding to --foreground, and --preserve-status respectively.
+ Improvements
+ * cksum -a crc, makes use of AVX2, AVX512, and ARMv8 SIMD extensions
+ for time reductions of up to 40%, 60%, and 80% respectively.
+ * 'head -c NUM', 'head -n NUM', 'nl -l NUM', 'nproc --ignore NUM',
+ 'tail -c NUM', 'tail -n NUM', and 'tail --max-unchanged-stats NUM’
+ no longer fail merely because NUM stands for 2**64 or more.
+ * sort operates more efficiently when used on pseudo files with
+ an apparent size of 0, like those in /proc.
+ * stat and tail now know about the "bcachefs", and "pidfs" file system types.
+ stat -f -c%T now reports the file system type,
+ and tail -f uses inotify for these file systems.
+ * wc now reads a minimum of 256KiB at a time.
+ This was previously 16KiB and increasing to 256KiB was seen to increase
+ wc -l performance by about 10% when reading cached files on modern systems.
+- coreutils-fix-gnulib-time_r-tests.patch: Remove now-upstream patch.
+- coreutils-9.6-ls-Z-crash-fix.patch: Add upstream patch from after the release.
+- coreutils.spec (Patch920): Exchange names of above patch files accordingly.
+- coreutils-i18n.patch: Refresh patch, manually porting some upstream fixes
+ into the i18n chunks for expand.c, fold.c and unexpand.c.
+- Refresh all other patches:
+ * coreutils-disable_tests.patch
+ * coreutils-remove_hostname_documentation.patch
+ * coreutils-remove_kill_documentation.patch
+ * coreutils-skip-gnulib-test-tls.patch
+ * coreutils-tests-shorten-extreme-factor-tests.patch
+ * coreutils-tests-workaround-make-fdleak.patch
+
+-------------------------------------------------------------------
+Sun Sep 29 14:36:55 UTC 2024 - Bernhard Voelker
+
+- coreutils-i18n.patch: fold(1): fix fold -b with UTF8 locale.
+ Sync fix in I18N patch from Fedora/Redhat and add a test. (RHEL-60295)
+ Original report: https://access.redhat.com/solutions/3459791
+
-------------------------------------------------------------------
Fri Jul 19 07:57:52 UTC 2024 - Andreas Schwab
diff --git a/coreutils.spec b/coreutils.spec
index 0214ec2..3bca20b 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
#
# spec file for package coreutils
#
-# Copyright (c) 2024 SUSE LLC
+# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -30,7 +30,7 @@
%global psuffix %{nil}
%endif
Name: coreutils%{?psuffix}
-Version: 9.5
+Version: 9.8
Release: 0
Summary: GNU Core Utilities
License: GPL-3.0-or-later
@@ -46,8 +46,6 @@ Patch4: coreutils-i18n.patch
Patch8: coreutils-sysinfo.patch
# OBS / RPMLINT require /usr/bin/timeout to be built with the -fpie option.
Patch100: coreutils-build-timeout-as-pie.patch
-# There is no network in the build root so make the test succeed
-Patch112: coreutils-getaddrinfo.patch
# Assorted fixes
Patch113: coreutils-misc.patch
# Skip 2 valgrind'ed sort tests on ppc/ppc64 which would fail due to
@@ -64,8 +62,9 @@ Patch501: coreutils-test_without_valgrind.patch
# tests: skip tests/rm/ext3-perf.sh temporarily as it hangs on OBS.
Patch810: coreutils-skip-tests-rm-ext3-perf.patch
Patch900: coreutils-tests-workaround-make-fdleak.patch
-# Upstream gnulib patch for coreutils-9.5.
-Patch920: coreutils-fix-gnulib-time_r-tests.patch
+# Upstream patch on top of v9.8 for 'tail -nN' for larger N; remove for >v9.8.
+Patch910: coreutils-9.8-tail-large-num-of-files.patch
+
BuildRequires: automake
BuildRequires: gmp-devel
BuildRequires: hostname
@@ -143,7 +142,7 @@ This package contains the documentation for the GNU Core Utilities.
%prep
%setup -q -n coreutils-%{version}
-%patch -P 4 -p1
+%patch -P 4
%patch -P 1
%patch -P 3
%patch -P 8
@@ -151,7 +150,6 @@ This package contains the documentation for the GNU Core Utilities.
%if 0%{?suse_version} <= 1320
%patch -P 100
%endif
-%patch -P 112
%patch -P 113
%patch -P 300
@@ -167,7 +165,7 @@ This package contains the documentation for the GNU Core Utilities.
%patch -P 810
%patch -P 900
-%patch -P 920
+%patch -P 910
# ================================================
%build