Compare commits

2 Commits
main ... 1.1

19 changed files with 1469 additions and 1116 deletions

View File

@@ -0,0 +1,105 @@
# based on commit 8c9602e3a145e9596dc1a63c6ed67865814b6633
# remove NEWS, offsets and fuzziness
# adapt test to old code base
Author: Pádraig Brady <P@draigBrady.com>
Date: Tue May 20 16:03:44 2025 +0100
sort: fix buffer under-read (CWE-127)
* src/sort.c (begfield): Check pointer adjustment
to avoid Out-of-range pointer offset (CWE-823).
(limfield): Likewise.
* tests/sort/sort-field-limit.sh: Add a new test,
which triggers with ASAN or Valgrind.
* tests/local.mk: Reference the new test.
* NEWS: Mention bug fix introduced in v7.2 (2009).
Fixes https://bugs.gnu.org/78507
---
src/sort.c | 12 ++++++++++--
tests/local.mk | 1 +
tests/sort/sort-field-limit.sh | 41 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 52 insertions(+), 2 deletions(-)
--- a/src/sort.c
+++ b/src/sort.c
@@ -1792,7 +1792,11 @@ begfield_uni (const struct line *line, c
++ptr;
/* Advance PTR by SCHAR (if possible), but no further than LIM. */
- ptr = MIN (lim, ptr + schar);
+ size_t remaining_bytes = lim - ptr;
+ if (schar < remaining_bytes)
+ ptr += schar;
+ else
+ ptr = lim;
return ptr;
}
@@ -1953,7 +1957,11 @@ limfield_uni (struct line const *line, s
++ptr;
/* Advance PTR by ECHAR (if possible), but no further than LIM. */
- ptr = MIN (lim, ptr + echar);
+ size_t remaining_bytes = lim - ptr;
+ if (echar < remaining_bytes)
+ ptr += echar;
+ else
+ ptr = lim;
}
return ptr;
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -382,6 +382,7 @@ all_tests = \
tests/sort/sort-debug-keys.sh \
tests/sort/sort-debug-warn.sh \
tests/sort/sort-discrim.sh \
+ tests/sort/sort-field-limit.sh \
tests/sort/sort-files0-from.pl \
tests/sort/sort-float.sh \
tests/misc/sort-mb-tests.sh \
--- /dev/null
+++ b/tests/sort/sort-field-limit.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# From 7.2-9.7, this would trigger an out of bounds mem read
+
+# 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ sort
+getlimits_
+
+# This issue triggers with valgrind or ASAN
+valgrind --error-exitcode=1 sort --version 2>/dev/null &&
+ VALGRIND='valgrind --error-exitcode=1'
+
+{ printf '%s\n' aa bb; } > in || framework_failure_
+
+_POSIX2_VERSION=200809 $VALGRIND sort +0.${LONG_MAX}R in > out 2> err
+perl -pe 's{(==\d+== |Command: sort .* in)}{}g' err > expected
+_POSIX2_VERSION=200809 $VALGRIND sort +0.${SIZE_MAX}R in > out 2> err
+perl -pe 's{(==\d+== |Command: sort .* in)}{}g' err | diff -u expected - >&2 || fail=1
+compare in out || fail=1
+
+_POSIX2_VERSION=200809 $VALGRIND sort +1 -1.${LONG_MAX}R in > out 2> err
+perl -pe 's{(==\d+== |Command: sort .* in)}{}g' err > expected
+_POSIX2_VERSION=200809 $VALGRIND sort +1 -1.${SIZE_MAX}R in > out 2> err
+perl -pe 's{(==\d+== |Command: sort .* in)}{}g' err | diff -u expected - >&2 || fail=1
+compare in out || fail=1
+
+Exit $fail

View File

@@ -0,0 +1,34 @@
Upstream patch on top of coreutils-9.4 fixing CVE-2024-0684.
https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=c4c5ed8f4e9cd55a12966
From c4c5ed8f4e9cd55a12966d4f520e3a13101637d9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 16 Jan 2024 13:48:32 -0800
Subject: [PATCH] split: do not shrink hold buffer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* src/split.c (line_bytes_split): Do not shrink hold buffer.
If its large for this batch its likely to be large for the next
batch, and for split its not worth the complexity/CPU hassle to
shrink it. Do not assume hold_size can be bufsize.
---
src/split.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/split.c b/src/split.c
index 64020c859..037960a59 100644
--- a/src/split.c
+++ b/src/split.c
@@ -809,10 +809,7 @@ line_bytes_split (intmax_t n_bytes, char *buf, idx_t bufsize)
{
cwrite (n_out == 0, hold, n_hold);
n_out += n_hold;
- if (n_hold > bufsize)
- hold = xirealloc (hold, bufsize);
n_hold = 0;
- hold_size = bufsize;
}
/* Output to eol if present. */

BIN
coreutils-9.4.tar.xz Normal file

Binary file not shown.

16
coreutils-9.4.tar.xz.sig Normal file
View File

@@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEbDfcEhIaUAa8HbgE32/ZcTBgN9kFAmTuCiAACgkQ32/ZcTBg
N9ldkg//bS5pBA3f/2p6sHpZVvtgXhbLPTIczMRuANfzGfjrWqC5UMa3t2g04A2T
gCx4p2cmDv0eBF2esUGirYHq+chGP12dLWKQLdhnyB6gDQS0MTSHNtjT61UXJ2jp
L4vrggrbpDIWzprXfRZH75GbC+D/A2O/Gdm3EKRSv5Jcoe1BgDtoHR8zn4TP4dJP
PlP1QMMoyG6ta/PuTh7/KlaYFLWdBh7mS1FMEl5w2LuG65Ms4MOJZ+wXsdHDA6gk
pgjQYAPSH37dDTSJzfxGNxlEdcTztoSNcOBGGngnCAvxRr3W3KM/ktQlphbYlu3J
9JKGDn3oOnkNxX1iUJLGs4/x0v6d89pdBFhiKqe47ZyJfJ0QQVWoTn79CUc7Gv2G
/NKOoEsnk/1eh4TCxb8WHFu5JU+E1PmLRD3I5uiFFEWhDhPj4xeo6Y74R6+6KLAw
ZArS1gL35aGLfed6Pmr9Nkh7j3jGAcsHVCre7PkCCYOyQArch81iTvG+aHFzSbnM
YLnsoZtfNtmspATFryZ+y8qOyVVK2+aOrgzpXDHUTtY7S1IUJjO8cQUHuG9JpQU1
YNkr7/w/JVe+2MvGODMiKQPP0/gKDfRQg5WIlKFVSVrEoGcX+ivA9nG6jCf7nWd9
RdONbO/I69ZI24n0TYkGfal+P1hbt9cogGr4j5kRpstj8eXSDws=
=GOzh
-----END PGP SIGNATURE-----

View File

@@ -1,61 +0,0 @@
From 14f2d2317b2f935cb2277a4140c1afa569be9629 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Fri, 17 Jan 2025 17:29:34 +0000
Subject: [PATCH] ls: fix crash with --context
* src/ls.c (main): Flag that we need to stat()
if we're going to get security context (call file_has_aclinfo_cache).
(file_has_aclinfo_cache): Be defensive and only lookup the device
for the file if the stat has been performed.
(has_capability_cache): Likewise.
* tests/ls/selinux-segfault.sh: Add a test case.
* NEWS: Mention the bug fix.
Reported by Bruno Haible.
---
src/ls.c | 6 +++---
tests/ls/selinux-segfault.sh | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
Index: coreutils-9.6/src/ls.c
===================================================================
--- coreutils-9.6.orig/src/ls.c
+++ coreutils-9.6/src/ls.c
@@ -1768,7 +1768,7 @@ main (int argc, char **argv)
format_needs_stat = ((sort_type == sort_time) | (sort_type == sort_size)
| (format == long_format)
- | print_block_size | print_hyperlink);
+ | print_block_size | print_hyperlink | print_scontext);
format_needs_type = ((! format_needs_stat)
& (recursive | print_with_color | print_scontext
| directories_first
@@ -3309,7 +3309,7 @@ file_has_aclinfo_cache (char const *file
static int unsupported_scontext_err;
static dev_t unsupported_device;
- if (f->stat.st_dev == unsupported_device)
+ if (f->stat_ok && f->stat.st_dev == unsupported_device)
{
ai->buf = ai->u.__gl_acl_ch;
ai->size = 0;
@@ -3342,7 +3342,7 @@ has_capability_cache (char const *file,
found that has_capability fails indicating lack of support. */
static dev_t unsupported_device;
- if (f->stat.st_dev == unsupported_device)
+ if (f->stat_ok && f->stat.st_dev == unsupported_device)
{
errno = ENOTSUP;
return 0;
Index: coreutils-9.6/tests/ls/selinux-segfault.sh
===================================================================
--- coreutils-9.6.orig/tests/ls/selinux-segfault.sh
+++ coreutils-9.6/tests/ls/selinux-segfault.sh
@@ -30,4 +30,7 @@ mkdir sedir || framework_failure_
ln -sf missing sedir/broken || framework_failure_
returns_ 1 ls -L -R -Z -m sedir > out || fail=1
+# ls 9.6 would segfault with the following
+ls -Z . > out || fail=1
+
Exit $fail

BIN
coreutils-9.6.tar.xz (Stored with Git LFS)

Binary file not shown.

View File

@@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEbDfcEhIaUAa8HbgE32/ZcTBgN9kFAmeKeeoACgkQ32/ZcTBg
N9m4JA/8DDvn6KAIa5q95yH37wtJfp2nau1BqjCYDxh51x4q0RX6dc7VHXvxkNeD
JCkL8tkzWEEZyK1NHHfaXq9xO0WgXvo0NPdAzSeB1+yDgH9RZR5EdkcgTmOsdx5A
gO/Ki/rVpUh9Xi5+Njc55xrH1H9NNT+71aWFde+DIU1iUqQRpBW7foEH4gjsTx+z
eyZ8CIbNwoQqhS4p0UzgQlYAO7cA0KyOVDcwfloa5dd9laJxKFTKJjsWXi07u5iR
tC34n1ZYOO5PVlpHCQ6zpGzkvRHpxhduvPi17wpLeE7kmx8DsjfGvk2L3qyJKcHg
58c7Ca7IvxcPePezK6k6/zYmGtj1Bol89YHNFVV0ERnL9BuT0v7LGJqZu9Efuutt
6hlkgMRpScm3G0dGAoPl9Qqpya8EtMF6WypAtiGH2lR+SV7F7C4lRUUKR56DKKd2
RvlTpWkgNYytnm52hVNEIOYnGcsj4EmURRuGiEhqBRph0VxEKs8+2P67UQib/k7M
7E/5JEpNAOS8ikkN6Fyq2AzPoDKOrCGqNScqbb2xxViNomWyQlc8RDIOG/ydDIaW
J8cqiT07Sw4mUXJTs/E3WdW4ZOP9vpr2KeirG5eoYE+1osx5ZP9npE+gNMGJzYhX
MX8iIuc9DdPGxxvL/Td++gEIG0QzSh+W0TUVcdk5qdtXlf7R2ok=
=ChFm
-----END PGP SIGNATURE-----

View File

@@ -6,7 +6,7 @@ Index: gnulib-tests/gnulib.mk
===================================================================
--- gnulib-tests/gnulib.mk.orig
+++ gnulib-tests/gnulib.mk
@@ -1528,10 +1528,10 @@ EXTRA_DIST += test-getloadavg.c signatur
@@ -1115,10 +1115,10 @@ EXTRA_DIST += test-getloadavg.c signatur
## begin gnulib module getlogin-tests

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,38 @@
---
gnulib-tests/test-isnanl.h | 5 +++--
tests/help/help-version.sh | 1 +
tests/other-fs-tmpdir | 3 +++
2 files changed, 4 insertions(+)
3 files changed, 7 insertions(+), 2 deletions(-)
Index: gnulib-tests/test-isnanl.h
===================================================================
--- gnulib-tests/test-isnanl.h.orig
+++ gnulib-tests/test-isnanl.h
@@ -47,7 +47,7 @@ main ()
/* Quiet NaN. */
ASSERT (isnanl (NaNl ()));
-#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
+#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT && 0
/* A bit pattern that is different from a Quiet NaN. With a bit of luck,
it's a Signalling NaN. */
{
@@ -98,6 +98,7 @@ main ()
{ LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
ASSERT (isnanl (x.value));
}
+#if 0
/* isnanl should return something for noncanonical values. */
{ /* Pseudo-NaN. */
static memory_long_double x =
@@ -125,6 +126,6 @@ main ()
ASSERT (isnanl (x.value) || !isnanl (x.value));
}
#endif
-
+#endif
return 0;
}
Index: tests/help/help-version.sh
===================================================================
--- tests/help/help-version.sh.orig

View File

@@ -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''.
@@ -205,7 +204,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
@@ -428,7 +427,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
@@ -16482,7 +16480,6 @@ information.
@@ -16227,7 +16225,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
@@ -17395,15 +17392,6 @@ This is non-portable, even across GNU/Li
@@ -17118,15 +17115,6 @@ Note this is non-portable (even across G
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
@@ -17457,34 +17445,6 @@ Print the kernel version.
@@ -17180,34 +17168,6 @@ Print the kernel version.
@exitstatus

View File

@@ -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''.
@@ -207,7 +206,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
@@ -455,10 +453,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
@@ -18918,90 +18912,6 @@ timeout -s INT 5s env --ignore-signal=IN
@@ -18628,90 +18622,6 @@ timeout -s INT 5s env --ignore-signal=IN
timeout -s INT -k 3s 5s env --ignore-signal=INT sleep 20
@end example

View File

@@ -21,7 +21,7 @@ Index: gnulib-tests/gnulib.mk
===================================================================
--- gnulib-tests/gnulib.mk.orig
+++ gnulib-tests/gnulib.mk
@@ -3567,9 +3567,10 @@ EXTRA_DIST += test-timespec.c macros.h
@@ -2765,9 +2765,10 @@ EXTRA_DIST += test-timespec.c macros.h
## begin gnulib module tls-tests

View File

@@ -16,7 +16,7 @@ Index: tests/local.mk
===================================================================
--- tests/local.mk.orig
+++ tests/local.mk
@@ -758,14 +758,9 @@ all_tests = \
@@ -745,14 +745,9 @@ all_tests = \
# See tests/factor/create-test.sh.
tf = tests/factor
factor_tests = \
@@ -27,10 +27,10 @@ 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)/t37.sh
- $(tf)/t35.sh $(tf)/t36.sh
+ $(tf)/t00.sh \
+ $(tf)/t05.sh \
+ $(tf)/t36.sh $(tf)/t37.sh
+ $(tf)/t36.sh
$(factor_tests): $(tf)/run.sh $(tf)/create-test.sh
$(AM_V_GEN)$(MKDIR_P) $(tf)

View File

@@ -6,7 +6,7 @@ Index: tests/init.sh
===================================================================
--- tests/init.sh.orig
+++ tests/init.sh
@@ -731,6 +731,16 @@ compare ()
@@ -690,6 +690,16 @@ compare ()
}
# -----------------------------------------------------------------------------

View File

@@ -1,238 +1,10 @@
-------------------------------------------------------------------
Fri Jan 17 22:22:08 UTC 2025 - Bernhard Voelker <mail@bernhard-voelker.de>
Mon Jun 2 09:30:09 UTC 2025 - rw@suse.com
- 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
%<i>$ format, where '<i>' 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 <mail@bernhard-voelker.de>
- 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 <schwab@suse.de>
- Avoid empty scriptlets
-------------------------------------------------------------------
Tue Jul 9 20:22:23 UTC 2024 - Bernhard Voelker <mail@bernhard-voelker.de>
- coreutils-i18n.patch: fold(1): fix exit code for non-existent file.
The exit code of fold(1) was zero for non-existent file:
$ fold badfile; echo $?
fold: badfile: No such file or directory
0
The bug was introduced by the downstrean I18N patch. (rhbz#2296201)
-------------------------------------------------------------------
Mon Apr 1 18:07:16 UTC 2024 - Bernhard Voelker <mail@bernhard-voelker.de>
- Update to 9.5:
Bug fixes:
* chmod -R now avoids a race where an attacker may replace a traversed file
with a symlink, causing chmod to operate on an unintended file.
[This bug was present in "the beginning".]
* cp, mv, and install no longer issue spurious diagnostics like "failed
to preserve ownership" when copying to GNU/Linux CIFS file systems.
They do this by working around some Linux CIFS bugs.
* cp --no-preserve=mode will correctly maintain set-group-ID bits
for created directories. Previously on systems that didn't support ACLs,
cp would have reset the set-group-ID bit on created directories.
[bug introduced in coreutils-8.20]
* join and uniq now support multi-byte characters better.
For example, 'join -tX' now works even if X is a multi-byte character,
and both programs now treat multi-byte characters like U+3000
IDEOGRAPHIC SPACE as blanks if the current locale treats them so.
* numfmt options like --suffix no longer have an arbitrary 127-byte limit.
[bug introduced with numfmt in coreutils-8.21]
* mktemp with --suffix now better diagnoses templates with too few X's.
Previously it conflated the insignificant --suffix in the error.
[bug introduced in coreutils-8.1]
* sort again handles thousands grouping characters in single-byte locales
where the grouping character is greater than CHAR_MAX. For e.g. signed
character platforms with a 0xA0 (aka &nbsp) grouping character.
[bug introduced in coreutils-9.1]
* split --line-bytes with a mixture of very long and short lines
no longer overwrites the heap (CVE-2024-0684).
[bug introduced in coreutils-9.2]
* tail no longer mishandles input from files in /proc and /sys file systems,
on systems with a page size larger than the stdio BUFSIZ.
[This bug was present in "the beginning".]
* timeout avoids a narrow race condition, where it might kill arbitrary
processes after a failed process fork.
[bug introduced with timeout in coreutils-7.0]
* timeout avoids a narrow race condition, where it might fail to
kill monitored processes immediately after forking them.
[bug introduced with timeout in coreutils-7.0]
* wc no longer fails to count unprintable characters as parts of words.
[bug introduced in textutils-2.1]
Changes in behavior:
* base32 and base64 no longer require padding when decoding.
Previously an error was given for non padded encoded data.
* base32 and base64 have improved detection of corrupted encodings.
Previously encodings with non zero padding bits were accepted.
* basenc --base16 -d now supports lower case hexadecimal characters.
Previously an error was given for lower case hex digits.
* cp --no-clobber, and mv -n no longer exit with failure status if
existing files are encountered in the destination. Instead they revert
to the behavior from before v9.2, silently skipping existing files.
* ls --dired now implies long format output without hyperlinks enabled,
and will take precedence over previously specified formats or hyperlink
mode.
* numfmt will accept lowercase 'k' to indicate Kilo or Kibi units on input,
and uses lowercase 'k' when outputting such units in '--to=si' mode.
* pinky no longer tries to canonicalize the user's login location by default,
rather requiring the new --lookup option to enable this often slow feature.
* wc no longer ignores encoding errors when counting words.
Instead, it treats them as non white space.
New features:
* chgrp now accepts the --from=OWNER:GROUP option to restrict changes to files
with matching current OWNER and/or GROUP, as already supported by chown(1).
* chmod adds support for -h, -H,-L,-P, and --dereference options, providing
more control over symlink handling. This supports more secure handling of
CLI arguments, and is more consistent with chown, and chmod on other
systems.
* cp now accepts the --keep-directory-symlink option (like tar), to preserve
and follow existing symlinks to directories in the destination.
* cp and mv now accept the --update=none-fail option, which is similar
to the --no-clobber option, except that existing files are diagnosed,
and the command exits with failure status if existing files.
The -n,--no-clobber option is best avoided due to platform differences.
* env now accepts the -a,--argv0 option to override the zeroth argument
of the command being executed.
* mv now accepts an --exchange option, which causes the source and
destination to be exchanged. It should be combined with
--no-target-directory (-T) if the destination is a directory.
The exchange is atomic if source and destination are on a single
file system that supports atomic exchange; --exchange is not yet
supported in other situations.
* od now supports printing IEEE half precision floating point with -t fH,
or brain 16 bit floating point with -t fB, where supported by the compiler.
* tail now supports following multiple processes, with repeated --pid options.
Improvements:
* cp,mv,install,cat,split now read and write a minimum of 256KiB at a time.
This was previously 128KiB and increasing to 256KiB was seen to increase
throughput by 10-20% when reading cached files on modern systems.
* env,kill,timeout now support unnamed signals. kill(1) for example now
supports sending such signals, and env(1) will list them appropriately.
* SELinux operations in file copy operations are now more efficient,
avoiding unneeded MCS/MLS label translation.
* sort no longer dynamically links to libcrypto unless -R is used.
This decreases startup overhead in the typical case.
* wc is now much faster in single-byte locales and somewhat faster in
multi-byte locales.
- coreutils-9.4.split-CVE-2024-0684.patch: Remove now-upstream patch.
- gnulib-readutmp-under-gdm.patch: Likewise.
- gnulib-readutmp.patch: Likewise.
- coreutils-i18n.patch: Remove multi-byte patches for join and uniq, as the
upstream version now handles those tests.
Pull in gnulib module mbchar manually, as it is a dependency of mbfile,
but dropped out of the upstream dependency chain.
- coreutils-misc.patch: Remove change for gnulib-tests/test-isnanl.h.
- coreutils-fix-gnulib-time_r-tests.patch: Add upstream gnulib patch to skip
French test if TZ='Europe/Paris' does not work.
-------------------------------------------------------------------
Mon Feb 26 10:48:14 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
- Use %patch -P N instead of deprecated %patchN.
- coreutils-9.4.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 Jan 21 09:50:55 UTC 2024 - Bernhard Voelker <mail@bernhard-voelker.de>

View File

@@ -1,7 +1,7 @@
#
# spec file for package coreutils
# spec file
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# 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.6
Version: 9.4
Release: 0
Summary: GNU Core Utilities
License: GPL-3.0-or-later
@@ -50,6 +50,12 @@ Patch100: coreutils-build-timeout-as-pie.patch
Patch112: coreutils-getaddrinfo.patch
# Assorted fixes
Patch113: coreutils-misc.patch
# Upstream gnulib commits (squashed) to fix gnulib seg.faults
# if there is no session:
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65617
Patch114: gnulib-readutmp.patch
# Upstream gnulib patch to fix crash when gdm is in use. [bsc#1215361]
Patch115: gnulib-readutmp-under-gdm.patch
# Skip 2 valgrind'ed sort tests on ppc/ppc64 which would fail due to
# a glibc issue in mkstemp.
Patch300: coreutils-skip-some-sort-tests-on-ppc.patch
@@ -64,10 +70,8 @@ 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 coreutils patch right after the release was done:
# `ls -Z dir` would crash. [bug introduced in coreutils-9.6]
# see <https://lists.gnu.org/r/coreutils/2025-01/msg00054.html>
Patch920: coreutils-9.6-ls-Z-crash-fix.patch
Patch920: coreutils-9.4.split-CVE-2024-0684.patch
Patch921: coreutils-9.4.sort-CVE-2025-5278.patch
BuildRequires: automake
BuildRequires: gmp-devel
BuildRequires: hostname
@@ -145,31 +149,34 @@ This package contains the documentation for the GNU Core Utilities.
%prep
%setup -q -n coreutils-%{version}
%patch -P 4 -p1
%patch -P 1
%patch -P 3
%patch -P 8
%patch4 -p1
%patch1
%patch3
%patch8
#
%if 0%{?suse_version} <= 1320
%patch -P 100
%patch100
%endif
%patch -P 112
%patch -P 113
%patch112
%patch113
%patch114 -p1
%patch115 -p1
%patch -P 300
%patch300
%ifarch %{ix86} x86_64 ppc ppc64
%patch -P 301
%patch301
%endif
%patch -P 303
%patch -P 304
%patch -P 500
%patch -P 501
%patch303
%patch304
%patch500
%patch501
%patch -P 810
%patch -P 900
%patch -P 920 -p1
%patch810
%patch900
%patch920 -p1
%patch921 -p1
# ================================================
%build
@@ -241,19 +248,18 @@ install src/{pinky,uptime,users,who} %{buildroot}%{_bindir}/
%endif
# ================================================
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
%post
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
%{?regenerate_initrd_post}
%endif
%dnl ================================================
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
# ================================================
%posttrans
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
%{?regenerate_initrd_posttrans}
%endif
%dnl ================================================
# ================================================
%files
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"

View File

@@ -0,0 +1,35 @@
Upstream gnulib patch to fix crash when gdm is in use. [bsc#1215361]
From 579f2d6f3d1d817c2f7e2c603c9a3ded63dcaa92 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Fri, 15 Sep 2023 17:40:10 +0200
Subject: [PATCH] readutmp: Fix crash when gdm is in use.
Reported by Thorsten Kukuk <kukuk@suse.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-09/msg00093.html>.
* lib/readutmp.c (read_utmp_from_systemd): Don't use the value returned
by sd_session_get_display if it is NULL.
---
lib/readutmp.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/readutmp.c b/lib/readutmp.c
index ec09feb59b..d8213e7ad5 100644
--- a/lib/readutmp.c
+++ b/lib/readutmp.c
@@ -873,7 +873,10 @@ read_utmp_from_systemd (idx_t *n_entries, STRUCT_UTMP **utmp_buf, int options)
char *display;
if (sd_session_get_display (session, &display) < 0)
display = NULL;
- host = display;
+ /* Workaround: gdm "forgets" to pass the display to
+ systemd, thus display may be NULL here. */
+ if (display != NULL)
+ host = display;
}
}
else
--
2.42.0

43
gnulib-readutmp.patch Normal file
View File

@@ -0,0 +1,43 @@
This squashes 2 consecutive upstream gnulib commits
to fix gnulib seg.faults if there is no session:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65617
Upstream gnulib commit 3af1d7b0ce3a8e3ae565e7cea10cee6fd7cb8109
2023-08-31 Bruno Haible <bruno@clisp.org>
readutmp: Fix memory leak introduced by last commit.
* lib/readutmp.c (read_utmp_from_systemd): If num_sessions == 0 and
sessions != NULL, do call free (sessions).
Upstream gnulib commit 1e6a26f9312bb47e070f94b17b14dc1a6ffbb74f
2023-08-30 Paul Eggert <eggert@cs.ucla.edu>
readutmp: fix core dump if --enable-systemd
Problem reported by Thorsten Kukuk <https://bugs.gnu.org/65617>.
* lib/readutmp.c (read_utmp_from_systemd):
Dont assume session_ptr != NULL if num_sessions == 0.
In practice it can be null, and the man page OKs this behavior.
---
lib/readutmp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletion(-)
diff --git a/lib/readutmp.c b/lib/readutmp.c
index 0173b7e0c1..e99158677c 100644
--- a/lib/readutmp.c
+++ b/lib/readutmp.c
@@ -795,7 +795,7 @@ read_utmp_from_systemd (idx_t *n_entries, STRUCT_UTMP **utmp_buf, int options)
{
char **sessions;
int num_sessions = sd_get_sessions (&sessions);
- if (num_sessions >= 0)
+ if (num_sessions >= 0 && sessions != NULL)
{
char **session_ptr;
for (session_ptr = sessions; *session_ptr != NULL; session_ptr++)
--
2.42.0