Blame SOURCES/coreutils-i18n-fix2-expand-unexpand.patch

f5e30c
diff --git a/src/expand.c b/src/expand.c
f5e30c
index 380e020..310b349 100644
f5e30c
--- a/src/expand.c
f5e30c
+++ b/src/expand.c
f5e30c
@@ -129,15 +129,19 @@ expand (void)
f5e30c
 
f5e30c
       do
f5e30c
         {
f5e30c
-          do {
f5e30c
+          while (true) {
f5e30c
             mbf_getc (c, mbf);
f5e30c
-            if (mb_iseof (c))
f5e30c
+            if ((mb_iseof (c)) && (fp = next_file (fp)))
f5e30c
               {
f5e30c
-                mbf_init (mbf, fp = next_file (fp));
f5e30c
+                mbf_init (mbf, fp);
f5e30c
                 continue;
f5e30c
               }
f5e30c
+            else
f5e30c
+              {
f5e30c
+                break;
f5e30c
+              }
f5e30c
             }
f5e30c
-          while (false);
f5e30c
+
f5e30c
 
f5e30c
           if (convert)
f5e30c
             {
f5e30c
diff --git a/src/unexpand.c b/src/unexpand.c
f5e30c
index 3bbbd66..863a90a 100644
f5e30c
--- a/src/unexpand.c
f5e30c
+++ b/src/unexpand.c
f5e30c
@@ -164,15 +164,19 @@ unexpand (void)
f5e30c
 
f5e30c
       do
f5e30c
         {
f5e30c
-          do {
f5e30c
+          while (true) {
f5e30c
             mbf_getc (c, mbf);
f5e30c
-            if (mb_iseof (c))
f5e30c
+            if ((mb_iseof (c)) && (fp = next_file (fp)))
f5e30c
               {
f5e30c
-                mbf_init (mbf, fp = next_file (fp));
f5e30c
+                mbf_init (mbf, fp);
f5e30c
                 continue;
f5e30c
               }
f5e30c
+            else
f5e30c
+              {
f5e30c
+                break;
f5e30c
+              }
f5e30c
             }
f5e30c
-          while (false);
f5e30c
+
f5e30c
 
f5e30c
           if (convert)
f5e30c
             {
f5e30c
diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
f5e30c
index 7971e18..031be7a 100755
f5e30c
--- a/tests/expand/mb.sh
f5e30c
+++ b/tests/expand/mb.sh
f5e30c
@@ -44,6 +44,20 @@ EOF
f5e30c
 expand < in > out || fail=1
f5e30c
 compare exp out > /dev/null 2>&1 || fail=1
f5e30c
 
f5e30c
+#multiple files as an input
f5e30c
+cat <<\EOF >> exp || framework_failure_
f5e30c
+1234567812345678123456781
f5e30c
+.       .       .       .
f5e30c
+a       b       c       d
f5e30c
+.       .       .       .
f5e30c
+ä       ö       ü       ß
f5e30c
+.       .       .       .
f5e30c
+   äöü  .    öüä.       ä xx
f5e30c
+EOF
f5e30c
+
f5e30c
+expand ./in ./in > out || fail=1
f5e30c
+compare exp out > /dev/null 2>&1 || fail=1
f5e30c
+
f5e30c
 #test characters with display widths != 1
f5e30c
 env printf '12345678
f5e30c
 e\t|ascii(1)
f5e30c
diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
f5e30c
index 60d4c1a..8d75652 100755
f5e30c
--- a/tests/unexpand/mb.sh
f5e30c
+++ b/tests/unexpand/mb.sh
f5e30c
@@ -44,6 +44,22 @@ EOF
f5e30c
 unexpand -a < in > out || fail=1
f5e30c
 compare exp out > /dev/null 2>&1 || fail=1
f5e30c
 
f5e30c
+
f5e30c
+#multiple files as an input
f5e30c
+cat >> exp <<\EOF
f5e30c
+1234567812345678123456781
f5e30c
+.	.	.	.
f5e30c
+a	b	c	d
f5e30c
+.	.	.	.
f5e30c
+ä	ö	ü	ß
f5e30c
+.	.	.	.
f5e30c
+   äöü	.    öüä.	ä xx
f5e30c
+EOF
f5e30c
+
f5e30c
+
f5e30c
+unexpand -a ./in ./in > out || fail=1
f5e30c
+compare exp out > /dev/null 2>&1 || fail=1
f5e30c
+
f5e30c
 #test characters with a display width larger than 1
f5e30c
 
f5e30c
 env printf '12345678