Compare commits

...

2 Commits
rawhide ... f36

Author SHA1 Message Date
Kamil Dudka 98f2693202 Resolves: #2112870 - make the last fix actually effective 2022-08-02 14:22:15 +02:00
Kamil Dudka d559e8c810 Resolves: #2112870 - prevent unexpand from failing on control characters 2022-08-02 11:52:14 +02:00
2 changed files with 14 additions and 6 deletions

View File

@ -4131,7 +4131,7 @@ index cec392d..483f0ef 100644
{
/* Go back one column, and force recalculation of the
next tab stop. */
@@ -218,9 +277,9 @@ unexpand (void)
@@ -218,9 +277,11 @@ unexpand (void)
next_tab_column = column;
tab_index -= !!tab_index;
}
@ -4139,11 +4139,13 @@ index cec392d..483f0ef 100644
+ else if (!mb_iseq (c, '\n'))
{
- column++;
+ column += mb_width (c);
+ /* mb_width() returns 0 for control characters */
+ const int width = mb_width (c);
+ column += MAX(1, width);
if (!column)
die (EXIT_FAILURE, 0, _("input line is too long"));
}
@@ -228,8 +287,11 @@ unexpand (void)
@@ -228,8 +289,11 @@ unexpand (void)
if (pending)
{
if (pending > 1 && one_blank_before_tab_stop)
@ -4157,7 +4159,7 @@ index cec392d..483f0ef 100644
die (EXIT_FAILURE, errno, _("write error"));
pending = 0;
one_blank_before_tab_stop = false;
@@ -239,16 +301,17 @@ unexpand (void)
@@ -239,16 +303,17 @@ unexpand (void)
convert &= convert_entire_line || blank;
}
@ -4347,7 +4349,7 @@ diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm
index dc6b132..a2abc6d 100644
--- a/tests/Coreutils.pm
+++ b/tests/Coreutils.pm
@@ -264,6 +264,9 @@ sub run_tests ($$$$$)
@@ -269,6 +269,9 @@ sub run_tests ($$$$$)
# Yes, this is an arbitrary limit. If it causes trouble,
# consider removing it.
my $max = 30;

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 9.0
Release: 5%{?dist}
Release: 7%{?dist}
License: GPLv3+
Url: https://www.gnu.org/software/coreutils/
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
@ -269,6 +269,12 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%license COPYING
%changelog
* Mon Aug 01 2022 Kamil Dudka <kdudka@redhat.com> - 9.0-7
- make the last fix actually effective (#2112870)
* Mon Aug 01 2022 Kamil Dudka <kdudka@redhat.com> - 9.0-6
- prevent unexpand from failing on control characters (#2112870)
* Mon Mar 21 2022 Kamil Dudka <kdudka@redhat.com> - 9.0-5
- ls, stat: avoid triggering automounts (#2044981)