fix df/direct.sh and unexpand/mb.sh tests

Resolves: RHEL-151534
This commit is contained in:
Lukáš Zaoral 2026-03-21 13:53:05 +01:00
parent e7b758a0a7
commit 1467a4a433
No known key found for this signature in database
GPG Key ID: 39157506DD67752D
5 changed files with 82 additions and 64 deletions

View File

@ -7,11 +7,12 @@ 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 904ba0a..93c4eca 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,
@ -29,7 +30,7 @@ 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 9998939..bdcfba0 100644
--- a/src/df.c
+++ b/src/df.c
@@ -125,6 +125,9 @@ static bool print_type;
@ -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 a417907..d07601e 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -524,6 +524,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,15 +20,15 @@ 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/expand.c | 43 +++++---
src/local.mk | 4 +-
src/unexpand.c | 54 +++++++----
tests/expand/mb.sh | 98 ++++++++++++++++++++
src/unexpand.c | 57 ++++++----
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 | 99 +++++++++++++++++
11 files changed, 541 insertions(+), 37 deletions(-)
create mode 100644 lib/mbfile.c
create mode 100644 lib/mbfile.h
create mode 100644 m4/mbfile.m4
@ -36,10 +36,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 57e8eaf..7d53e28 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -152,6 +152,7 @@ gnulib_modules="
@@ -155,6 +155,7 @@ gnulib_modules="
maintainer-makefile
malloc-gnu
manywarnings
@ -48,10 +48,10 @@ index 8a0ff31..a1c78b2 100644
mbrtowc
mbsalign
diff --git a/configure.ac b/configure.ac
index 1e74b36..24c9725 100644
index c2ad08c..f5da816 100644
--- a/configure.ac
+++ b/configure.ac
@@ -427,6 +427,8 @@ fi
@@ -446,6 +446,8 @@ fi
# I'm leaving it here for now. This whole thing needs to be modernized...
gl_WINSIZE_IN_PTEM
@ -351,7 +351,7 @@ index 0000000..8589902
+ :
+])
diff --git a/src/expand.c b/src/expand.c
index 9fa2e10..380e020 100644
index 3412d7b..ec91d01 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -37,6 +37,9 @@
@ -364,7 +364,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);
@ -388,7 +388,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;
@ -416,7 +416,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"));
@ -460,7 +460,7 @@ index 9fa2e10..380e020 100644
}
diff --git a/src/local.mk b/src/local.mk
index 72db9c704..ef3bfa469 100644
index 72db9c7..ef3bfa4 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -415,8 +415,8 @@ src_basenc_CPPFLAGS = -DBASE_TYPE=42 $(AM_CPPFLAGS)
@ -475,7 +475,7 @@ index 72db9c704..ef3bfa469 100644
# Ensure we don't link against libcoreutils.a as that lib is
# not compiled with -fPIC which causes issues on 64 bit at least
diff --git a/src/unexpand.c b/src/unexpand.c
index 7801274..569a7ee 100644
index 09dafdb..e7f4e8a 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -38,6 +38,9 @@
@ -636,7 +636,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 @@
@ -737,12 +737,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 bf6a1c5..94c0f37 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -544,6 +544,7 @@ all_tests = \
@@ -572,6 +572,7 @@ all_tests = \
tests/du/threshold.sh \
tests/du/trailing-slash.sh \
tests/du/two-args.sh \
@ -750,7 +750,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 = \
@@ -719,6 +720,7 @@ all_tests = \
tests/touch/read-only.sh \
tests/touch/relative.sh \
tests/touch/trailing-slash.sh \
@ -760,10 +760,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..a7b6ad0
--- /dev/null
+++ b/tests/unexpand/mb.sh
@@ -0,0 +1,97 @@
@@ -0,0 +1,99 @@
+#!/bin/sh
+
+# Copyright (C) 2012-2015 Free Software Foundation, Inc.
@ -824,7 +824,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_
+
@ -846,7 +846,7 @@ index 0000000..60d4c1a
+ä\xFF |
+ ä\xFF|
+\xFF ä|
+äbcdef\xFF |
+äbcde\xFF |
+' > in || framework_failure_
+
+env printf '12345678
@ -856,11 +856,13 @@ 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
+
+Exit $fail
--
2.7.4
2.53.0

View File

@ -1,8 +1,8 @@
diff --git a/src/expand.c b/src/expand.c
index 380e020..310b349 100644
index ec91d01..8144e43 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 e7f4e8a..7a010e2 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 e4209a0..76be4d8 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 f304fbb..eaa2f15 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 8144e43..bf61aff 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 7a010e2..da80dac 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -116,16 +116,36 @@ unexpand (void)
@ -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 92962f6..f64542e 100755
--- a/tests/unexpand/mb.sh
+++ b/tests/unexpand/mb.sh
@@ -111,3 +111,62 @@ env printf '12345678
@@ -112,4 +112,62 @@ env printf '12345678
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.53.0

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.32
Release: 40%{?dist}
Release: 41%{?dist}
License: GPLv3+
Url: https://www.gnu.org/software/coreutils/
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
@ -333,6 +333,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%license COPYING
%changelog
* Sat Mar 21 2026 Lukáš Zaoral <lzaoral@redhat.com> - 8.32-41
- fix df/direct.sh and unexpand/mb.sh tests (RHEL-151534)
* Thu Jan 15 2026 Lukáš Zaoral <lzaoral@redhat.com> - 8.32-40
- fold: fix processing of malformed UTF-8 sequences (RHEL-136086)