import CS git coreutils-8.30-20.el8_10

This commit is contained in:
AlmaLinux RelEng Bot 2026-07-28 15:40:07 -04:00
parent 2db8636359
commit b9803ab09c
5 changed files with 117 additions and 77 deletions

View File

@ -7,14 +7,15 @@ Subject: [PATCH] coreutils-df-direct.patch
doc/coreutils.texi | 7 ++++++
src/df.c | 34 ++++++++++++++++++++++++++--
tests/df/direct.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 94 insertions(+), 2 deletions(-)
tests/local.mk | 1 +
4 files changed, 95 insertions(+), 2 deletions(-)
create mode 100755 tests/df/direct.sh
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 5b9a597..6810c15 100644
index 576dfbe..e246bd3 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -11898,6 +11898,13 @@ some systems (notably SunOS), doing this yields more up to date results,
@@ -11722,6 +11722,13 @@ some systems (notably SunOS), doing this yields more up to date results,
but in general this option makes @command{df} much slower, especially when
there are many or very busy file systems.
@ -29,10 +30,10 @@ index 5b9a597..6810c15 100644
@opindex --total
@cindex grand total of disk size, usage and available space
diff --git a/src/df.c b/src/df.c
index 48025b9..c8efa5b 100644
index 2ca487e..fd6e66e 100644
--- a/src/df.c
+++ b/src/df.c
@@ -125,6 +125,9 @@ static bool print_type;
@@ -121,6 +121,9 @@ static bool print_type;
/* If true, print a grand total at the end. */
static bool print_grand_total;
@ -42,7 +43,7 @@ index 48025b9..c8efa5b 100644
/* Grand total data. */
static struct fs_usage grand_fsu;
@@ -252,13 +255,15 @@ enum
@@ -248,13 +251,15 @@ enum
NO_SYNC_OPTION = CHAR_MAX + 1,
SYNC_OPTION,
TOTAL_OPTION,
@ -59,7 +60,7 @@ index 48025b9..c8efa5b 100644
{"inodes", no_argument, NULL, 'i'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, NULL, 'H'},
@@ -561,7 +566,10 @@ get_header (void)
@@ -510,7 +515,10 @@ get_header (void)
for (col = 0; col < ncolumns; col++)
{
char *cell = NULL;
@ -71,7 +72,7 @@ index 48025b9..c8efa5b 100644
if (columns[col]->field == SIZE_FIELD
&& (header_mode == DEFAULT_MODE
@@ -1464,6 +1472,17 @@ get_point (const char *point, const struct stat *statp)
@@ -1411,6 +1419,17 @@ get_point (const char *point, const struct stat *statp)
static void
get_entry (char const *name, struct stat const *statp)
{
@ -89,7 +90,7 @@ index 48025b9..c8efa5b 100644
if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
&& get_disk (name))
return;
@@ -1534,6 +1553,7 @@ or all file systems by default.\n\
@@ -1481,6 +1500,7 @@ or all file systems by default.\n\
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\
'-BM' prints sizes in units of 1,048,576 bytes;\n\
see SIZE format below\n\
@ -97,7 +98,7 @@ index 48025b9..c8efa5b 100644
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\
-H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\
"), stdout);
@@ -1624,6 +1644,9 @@ main (int argc, char **argv)
@@ -1571,6 +1591,9 @@ main (int argc, char **argv)
xstrtol_fatal (e, oi, c, long_options, optarg);
}
break;
@ -107,7 +108,7 @@ index 48025b9..c8efa5b 100644
case 'i':
if (header_mode == OUTPUT_MODE)
{
@@ -1720,6 +1743,13 @@ main (int argc, char **argv)
@@ -1667,6 +1690,13 @@ main (int argc, char **argv)
}
}
@ -123,7 +124,7 @@ index 48025b9..c8efa5b 100644
if (posix_format)
diff --git a/tests/df/direct.sh b/tests/df/direct.sh
new file mode 100755
index 0000000..8e4cfb8
index 0000000..8373705
--- /dev/null
+++ b/tests/df/direct.sh
@@ -0,0 +1,55 @@
@ -145,7 +146,7 @@ index 0000000..8e4cfb8
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ df
+
+df || skip_ "df fails"
@ -182,6 +183,18 @@ index 0000000..8e4cfb8
+compare file_out file_exp || fail=1
+
+Exit $fail
diff --git a/tests/local.mk b/tests/local.mk
index 48d7aff..c106102 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -513,6 +513,7 @@ all_tests = \
tests/df/no-mtab-status.sh \
tests/df/skip-duplicates.sh \
tests/df/skip-rootfs.sh \
+ tests/df/direct.sh \
tests/dd/ascii.sh \
tests/dd/direct.sh \
tests/dd/misc.sh \
--
2.31.1
2.53.0

View File

@ -20,14 +20,14 @@ Co-authored-by: Pádraig Brady <pbrady@redhat.com>
bootstrap.conf | 1 +
configure.ac | 2 +
lib/mbfile.c | 3 +
lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++
lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++
m4/mbfile.m4 | 14 +++
src/expand.c | 43 +++++----
src/unexpand.c | 54 +++++++----
tests/expand/mb.sh | 98 ++++++++++++++++++++
src/expand.c | 43 +++++---
src/unexpand.c | 59 ++++++----
tests/expand/mb.sh | 98 +++++++++++++++++
tests/local.mk | 2 +
tests/unexpand/mb.sh | 97 ++++++++++++++++++++
10 files changed, 535 insertions(+), 34 deletions(-)
tests/unexpand/mb.sh | 114 +++++++++++++++++++
10 files changed, 555 insertions(+), 36 deletions(-)
create mode 100644 lib/mbfile.c
create mode 100644 lib/mbfile.h
create mode 100644 m4/mbfile.m4
@ -35,10 +35,10 @@ Co-authored-by: Pádraig Brady <pbrady@redhat.com>
create mode 100755 tests/unexpand/mb.sh
diff --git a/bootstrap.conf b/bootstrap.conf
index 8a0ff31..a1c78b2 100644
index fcf29dc..3eaedc3 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -152,6 +152,7 @@ gnulib_modules="
@@ -153,6 +153,7 @@ gnulib_modules="
maintainer-makefile
malloc-gnu
manywarnings
@ -47,10 +47,10 @@ index 8a0ff31..a1c78b2 100644
mbrtowc
mbsalign
diff --git a/configure.ac b/configure.ac
index 1e74b36..24c9725 100644
index 9b1ead0..c24ce2a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -427,6 +427,8 @@ fi
@@ -439,6 +439,8 @@ fi
# I'm leaving it here for now. This whole thing needs to be modernized...
gl_WINSIZE_IN_PTEM
@ -350,7 +350,7 @@ index 0000000..8589902
+ :
+])
diff --git a/src/expand.c b/src/expand.c
index 9fa2e10..380e020 100644
index 6183fb8..34a559b 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -37,6 +37,9 @@
@ -363,7 +363,7 @@ index 9fa2e10..380e020 100644
#include "system.h"
#include "die.h"
#include "xstrndup.h"
@@ -100,19 +103,19 @@ expand (void)
@@ -98,19 +101,19 @@ expand (void)
{
/* Input stream. */
FILE *fp = next_file (NULL);
@ -387,7 +387,7 @@ index 9fa2e10..380e020 100644
/* The following variables have valid values only when CONVERT
is true: */
@@ -122,17 +125,23 @@ expand (void)
@@ -120,17 +123,23 @@ expand (void)
/* Index in TAB_LIST of next tab stop to examine. */
size_t tab_index = 0;
@ -415,7 +415,7 @@ index 9fa2e10..380e020 100644
{
/* Column the next input tab stop is on. */
uintmax_t next_tab_column;
@@ -151,32 +160,34 @@ expand (void)
@@ -149,32 +158,34 @@ expand (void)
if (putchar (' ') < 0)
die (EXIT_FAILURE, errno, _("write error"));
@ -459,7 +459,7 @@ index 9fa2e10..380e020 100644
}
diff --git a/src/unexpand.c b/src/unexpand.c
index 7801274..569a7ee 100644
index 8fdd80f..8701eca 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -38,6 +38,9 @@
@ -491,7 +491,7 @@ index 7801274..569a7ee 100644
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 = xnmalloc (max_column_width, sizeof (mbf_char_t));
+
+ mbf_init (mbf, fp);
@ -526,7 +526,7 @@ index 7801274..569a7ee 100644
if (blank)
{
@@ -180,16 +193,16 @@ unexpand (void)
@@ -180,30 +193,31 @@ unexpand (void)
if (next_tab_column < column)
die (EXIT_FAILURE, 0, _("input line is too long"));
@ -544,9 +544,10 @@ index 7801274..569a7ee 100644
- column++;
+ column += mb_width (c);
if (! (prev_blank && column == next_tab_column))
- if (! (prev_blank && column == next_tab_column))
+ if (! (prev_blank && column >= next_tab_column))
{
@@ -197,13 +210,14 @@ unexpand (void)
/* It is not yet known whether the pending blanks
will be replaced by tabs. */
if (column == next_tab_column)
one_blank_before_tab_stop = true;
@ -620,7 +621,7 @@ index 7801274..569a7ee 100644
diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
new file mode 100755
index 0000000..7971e18
index 0000000..dab27b4
--- /dev/null
+++ b/tests/expand/mb.sh
@@ -0,0 +1,98 @@
@ -721,12 +722,12 @@ index 0000000..7971e18
+expand < in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+
+exit $fail
+Exit $fail
diff --git a/tests/local.mk b/tests/local.mk
index 192f776..8053397 100644
index fb74b5d..1f19f1b 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -544,6 +544,7 @@ all_tests = \
@@ -561,6 +561,7 @@ all_tests = \
tests/du/threshold.sh \
tests/du/trailing-slash.sh \
tests/du/two-args.sh \
@ -734,7 +735,7 @@ index 192f776..8053397 100644
tests/id/gnu-zero-uids.sh \
tests/id/no-context.sh \
tests/id/context.sh \
@@ -684,6 +685,7 @@ all_tests = \
@@ -705,6 +706,7 @@ all_tests = \
tests/touch/read-only.sh \
tests/touch/relative.sh \
tests/touch/trailing-slash.sh \
@ -744,10 +745,10 @@ index 192f776..8053397 100644
# See tests/factor/create-test.sh.
diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
new file mode 100755
index 0000000..60d4c1a
index 0000000..5b4252d
--- /dev/null
+++ b/tests/unexpand/mb.sh
@@ -0,0 +1,97 @@
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+# Copyright (C) 2012-2015 Free Software Foundation, Inc.
@ -767,6 +768,7 @@ index 0000000..60d4c1a
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ unexpand
+getlimits_
+
+export LC_ALL=en_US.UTF-8
+
@ -808,7 +810,7 @@ index 0000000..60d4c1a
+e\t|ascii(1)
+\u00E9\t|composed(1)
+e\u0301\t|decomposed(1)
+\u3000\t|ideo-space(2)
+\t|ideo-space(2)
+\uFF0D\t|full-hypen(2)
+' > exp || framework_failure_
+
@ -830,7 +832,7 @@ index 0000000..60d4c1a
+ä\xFF |
+ ä\xFF|
+\xFF ä|
+äbcdef\xFF |
+äbcde\xFF |
+' > in || framework_failure_
+
+env printf '12345678
@ -840,11 +842,27 @@ index 0000000..60d4c1a
+ä\xFF\t|
+\tä\xFF|
+\xFF\tä|
+äbcdef\xFF\t|
+äbcde\xFF\t|
+' > exp || framework_failure_
+
+unexpand -a < in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+
+for mb_mul in 4 6; do
+ printf ' \n' | unexpand -t $(expr $SIZE_MAX / $mb_mul + 1) 2>err; ret=$?
+ test "$ret" = 1 || test "$ret" = 0 || { cat err; fail=1; }
+done
+
+# A blank whose display width exceeds the tab distance must not overrun
+# the pending-blank buffer. With -t1 every column is a tab stop, so a
+# width-2 ideographic space steps over the stop without landing on it;
+# the run of blanks then grew pending_blank without bound.
+ideo_space=$(env printf '\u3000')
+{ yes "$ideo_space" | head -n 40000 | tr -d '\n'; echo; } |
+ unexpand -t1 >out 2>err; ret=$?
+test "$ret" = 0 || { cat err; fail=1; }
+
+Exit $fail
--
2.7.4
2.54.0

View File

@ -1,8 +1,8 @@
diff --git a/src/expand.c b/src/expand.c
index 380e020..310b349 100644
index 34a559b..52d6ec1 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -129,15 +129,19 @@ expand (void)
@@ -127,15 +127,19 @@ expand (void)
do
{
@ -27,7 +27,7 @@ index 380e020..310b349 100644
if (convert)
{
diff --git a/src/unexpand.c b/src/unexpand.c
index 3bbbd66..863a90a 100644
index 6d5495f..fdef1d5 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -164,15 +164,19 @@ unexpand (void)
@ -55,7 +55,7 @@ index 3bbbd66..863a90a 100644
if (convert)
{
diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
index 7971e18..031be7a 100755
index dab27b4..3a5eb95 100755
--- a/tests/expand/mb.sh
+++ b/tests/expand/mb.sh
@@ -44,6 +44,20 @@ EOF
@ -80,7 +80,7 @@ index 7971e18..031be7a 100755
env printf '12345678
e\t|ascii(1)
diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
index 60d4c1a..8d75652 100755
index a7b6ad0..92962f6 100755
--- a/tests/unexpand/mb.sh
+++ b/tests/unexpand/mb.sh
@@ -44,6 +44,22 @@ EOF

View File

@ -4,16 +4,16 @@ Date: Thu, 7 Jul 2016 12:53:26 +0200
Subject: [PATCH] coreutils-i18n-un-expand-BOM.patch
---
src/expand-common.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++
src/expand-common.h | 12 ++++++
src/expand.c | 45 +++++++++++++++++++-
src/unexpand.c | 43 ++++++++++++++++++-
tests/expand/mb.sh | 71 ++++++++++++++++++++++++++++++++
tests/unexpand/mb.sh | 59 ++++++++++++++++++++++++++
6 files changed, 342 insertions(+), 2 deletions(-)
src/expand-common.c | 114 +++++++++++++++++++++++++++++++++++++++++++
src/expand-common.h | 12 +++++
src/expand.c | 45 ++++++++++++++++-
src/unexpand.c | 43 +++++++++++++++-
tests/expand/mb.sh | 71 +++++++++++++++++++++++++++
tests/unexpand/mb.sh | 58 ++++++++++++++++++++++
6 files changed, 341 insertions(+), 2 deletions(-)
diff --git a/src/expand-common.c b/src/expand-common.c
index 4657e46..97cbb09 100644
index 20ab023..e1c8943 100644
--- a/src/expand-common.c
+++ b/src/expand-common.c
@@ -19,6 +19,7 @@
@ -145,7 +145,7 @@ index 4657e46..97cbb09 100644
to the list of tab stops. */
extern void
diff --git a/src/expand-common.h b/src/expand-common.h
index 8cb2079..763bfda 100644
index cd32509..2ecf5e6 100644
--- a/src/expand-common.h
+++ b/src/expand-common.h
@@ -34,6 +34,18 @@ extern size_t max_column_width;
@ -168,7 +168,7 @@ index 8cb2079..763bfda 100644
extern void
add_tab_stop (uintmax_t tabval);
diff --git a/src/expand.c b/src/expand.c
index 310b349..4136824 100644
index 52d6ec1..50a4590 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -103,11 +103,33 @@ expand (void)
@ -235,7 +235,7 @@ index 310b349..4136824 100644
}
else
diff --git a/src/unexpand.c b/src/unexpand.c
index 863a90a..5681b58 100644
index a818773..b37b319 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -116,16 +116,36 @@ unexpand (void)
@ -266,7 +266,7 @@ index 863a90a..5681b58 100644
/* 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 * sizeof (mbf_char_t));
pending_blank = xnmalloc (max_column_width, sizeof (mbf_char_t));
- mbf_init (mbf, fp);
+ if (found_bom == true)
@ -305,7 +305,7 @@ index 863a90a..5681b58 100644
}
else
diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
index 031be7a..1621c84 100755
index 3a5eb95..6d6497a 100755
--- a/tests/expand/mb.sh
+++ b/tests/expand/mb.sh
@@ -109,4 +109,75 @@ env printf '12345678
@ -383,16 +383,15 @@ index 031be7a..1621c84 100755
+LC_ALL=C expand in1 in1 > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+
exit $fail
Exit $fail
diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
index 8d75652..9d4ee3e 100755
index b1f0b2e..4d31ffd 100755
--- a/tests/unexpand/mb.sh
+++ b/tests/unexpand/mb.sh
@@ -111,3 +111,62 @@ env printf '12345678
@@ -127,4 +127,62 @@ ideo_space=$(env printf '\u3000')
unexpand -t1 >out 2>err; ret=$?
test "$ret" = 0 || { cat err; fail=1; }
unexpand -a < in > out || fail=1
compare exp out > /dev/null 2>&1 || fail=1
+
+#BOM header test 1
+printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_
+1234567812345678123456781
@ -403,7 +402,6 @@ index 8d75652..9d4ee3e 100755
+. . . .
+ äöü . öüä. ä xx
+EOF
+env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_
+
+printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_
+1234567812345678123456781
@ -415,13 +413,13 @@ index 8d75652..9d4ee3e 100755
+ äöü . öüä. ä xx
+EOF
+
+unexpand < in > out || fail=1
+unexpand -a < in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+
+LANG=C unexpand < in > out || fail=1
+LANG=C unexpand -a < in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+
+LC_ALL=C unexpand < in > out || fail=1
+LC_ALL=C unexpand -a < in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+
+
@ -443,14 +441,16 @@ index 8d75652..9d4ee3e 100755
+EOF
+
+
+unexpand in in > out || fail=1
+unexpand -a in in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+
+LANG=C unexpand in in > out || fail=1
+LANG=C unexpand -a in in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+
+LC_ALL=C unexpand in in > out || fail=1
+LC_ALL=C unexpand -a in in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+
Exit $fail
--
2.9.3
2.54.0

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.30
Release: 17%{?dist}
Release: 20%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: https://www.gnu.org/software/coreutils/
@ -296,6 +296,15 @@ fi
%license COPYING
%changelog
* Wed Jun 10 2026 Lukáš Zaoral <lzaoral@redhat.com> - 8.30-20
- unexpand: fix heap overflow when a wide blank overshoots a tab stop (RHEL-182699)
* Mon Jun 08 2026 Lukáš Zaoral <lzaoral@redhat.com> - 8.30-19
- unexpand: fix stack overflow with large tabsizes (RHEL-182699)
* Sat Mar 21 2026 Lukáš Zaoral <lzaoral@redhat.com> - 8.30-18
- fix df/direct.sh and unexpand/mb.sh tests (RHEL-151533)
* Mon Jan 26 2026 Lukáš Zaoral <lzaoral@redhat.com> - 8.30-17
- fold: fix processing of malformed UTF-8 sequences (RHEL-140117)