(un)expand: fix a regression in handling of input files, where only the first file was processed.

This commit is contained in:
Jakub Martisko 2016-07-12 13:32:03 +02:00
parent 749ee571f6
commit d5648190a1
2 changed files with 112 additions and 1 deletions

View File

@ -0,0 +1,104 @@
diff -up ./src/expand.c.orig ./src/expand.c
--- ./src/expand.c.orig 2016-06-01 12:42:49.330373488 +0200
+++ ./src/expand.c 2016-06-07 14:35:16.011142041 +0200
@@ -173,15 +173,19 @@ expand (void)
do
{
- do {
+ while (true) {
mbf_getc (c, mbf);
- if (mb_iseof (c))
+ if ((mb_iseof (c)) && (fp = next_file (fp)))
{
- mbf_init (mbf, fp = next_file (fp));
+ mbf_init (mbf, fp);
continue;
}
+ else
+ {
+ break;
+ }
}
- while (false);
+
if (convert)
{
diff -up ./src/unexpand.c.orig ./src/unexpand.c
--- ./src/unexpand.c.orig 2016-06-07 14:26:57.380746446 +0200
+++ ./src/unexpand.c 2016-06-07 14:34:54.059256698 +0200
@@ -220,15 +220,19 @@ unexpand (void)
do
{
- do {
+ while (true) {
mbf_getc (c, mbf);
- if (mb_iseof (c))
+ if ((mb_iseof (c)) && (fp = next_file (fp)))
{
- mbf_init (mbf, fp = next_file (fp));
+ mbf_init (mbf, fp);
continue;
}
+ else
+ {
+ break;
+ }
}
- while (false);
+
if (convert)
{
diff -up ./tests/expand/mb.sh.orig ./tests/expand/mb.sh
--- ./tests/expand/mb.sh.orig 2016-05-11 14:13:53.095289000 +0200
+++ ./tests/expand/mb.sh 2016-06-07 14:38:48.259033445 +0200
@@ -44,6 +44,20 @@ EOF
expand < in > out || fail=1
compare exp out > /dev/null 2>&1 || fail=1
+#multiple files as an input
+cat <<\EOF >> exp || framework_failure_
+1234567812345678123456781
+. . . .
+a b c d
+. . . .
+ä ö ü ß
+. . . .
+ äöü . öüä. ä xx
+EOF
+
+expand ./in ./in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+
#test characters with display widths != 1
env printf '12345678
e\t|ascii(1)
diff -up ./tests/unexpand/mb.sh.orig ./tests/unexpand/mb.sh
--- ./tests/unexpand/mb.sh.orig 2016-06-07 14:41:44.210106466 +0200
+++ ./tests/unexpand/mb.sh 2016-06-07 14:52:28.848639772 +0200
@@ -44,6 +44,22 @@ EOF
unexpand -a < in > out || fail=1
compare exp out > /dev/null 2>&1 || fail=1
+
+#multiple files as an input
+cat >> exp <<\EOF
+1234567812345678123456781
+. . . .
+a b c d
+. . . .
+ä ö ü ß
+. . . .
+ äöü . öüä. ä xx
+EOF
+
+
+unexpand -a ./in ./in > out || fail=1
+compare exp out > /dev/null 2>&1 || fail=1
+
#test characters with a display width larger than 1
env printf '12345678

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.24
Release: 7%{?dist}
Release: 8%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -49,6 +49,8 @@ Patch800: coreutils-i18n.patch
Patch801: coreutils-i18n-expand-unexpand.patch
# The unexpand patch above is not correct. Sent to the patch authors
Patch803: coreutils-i18n-fix-unexpand.patch
#(un)expand - allow multiple files on input - broken by patch 801
Patch804: coreutils-i18n-fix2-expand-unexpand.patch
#getgrouplist() patch from Ulrich Drepper.
Patch908: coreutils-getgrouplist.patch
@ -153,6 +155,7 @@ the old GNU fileutils, sh-utils, and textutils packages.
%patch800 -p1 -b .i18n
%patch801 -p1 -b .i18n-expand
%patch803 -p1 -b .i18n-fix-expand
%patch804 -p1 -b .i18n-fix2-expand-unexpand
# Coreutils
%patch908 -p1 -b .getgrouplist
@ -389,6 +392,10 @@ fi
%{_sbindir}/chroot
%changelog
* Tue Jul 12 2016 Jakub Martisko <jamartis@redhat.com> - 8.24-8
- (un)expand fix a regression in handling of input files, where only
the first file was procesed.
* Thu May 19 2016 Kamil Dudka <kdudka@redhat.com> - 8.24-7
- df: prioritize mounts nearer the device root (#1001092)