Hi *,
Lukas notified me that the downstream I18N patch messed up functionality in
fold(1) again, this time for 'fold -b'.
Reproducer (with buggy dowstream-fold):
$ LC_ALL=en_US.UTF-8 fold -b -w6 <<< $'1234567890\nabcdefghij\n1234567890'
123456
7890
a
bcdefg
hij
12
345678
90
Instead, it should output the same as in the C locale:
$ LC_ALL=C fold -b -w6 <<< $'1234567890\nabcdefghij\n1234567890'
123456
7890
abcdef
ghij
123456
7890
I'd like to add the attached tests here.
Have a nice day,
Berny
From 5095dc205e56504ac20627af14d9436e29b9d0d2 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Sun, 29 Sep 2024 17:39:16 +0200
Subject: [PATCH] tests: add fold(1) test for --bytes option
Inspired by:
- https://access.redhat.com/solutions/3459791
- https://src.fedoraproject.org/rpms/coreutils/c/8080f5a15a20362c
* tests/misc/fold.pl (bw1, bw2): Add tests for 'fold -b'.
---
tests/misc/fold.pl | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/misc/fold.pl b/tests/misc/fold.pl
index 3a37840dc..2628f9555 100755
--- a/tests/misc/fold.pl
+++ b/tests/misc/fold.pl
@@ -36,6 +36,12 @@ my @Tests =
# The I18N patch was fixed only in July 2024. (rhbz#2296201).
['enoent', 'enoent', {EXIT => 1},
{ERR=>"$prog: enoent: No such file or directory\n"}],
+
+ # The downstream I18N patch made 'fold -b' mishandled '\n' in UTF locales.
+ # The I18N patch was fixed only in Sep 2024. (RHEL-60295)
+ ['bw1', '-b -w 4', {IN=>"abcdef\nghijkl"}, {OUT=>"abcd\nef\nghij\nkl"}],
+ ['bw2', '-b -w 6', {IN=>"1234567890\nabcdefghij\n1234567890"},
+ {OUT=>"123456\n7890\nabcdef\nghij\n123456\n7890"}],
);
my $save_temps = $ENV{DEBUG};
--
2.46.0