Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 104286 - coreutils-5.3.0-i18n-0.1.patch breaks expand
Summary: coreutils-5.3.0-i18n-0.1.patch breaks expand
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High blocker (vote)
Assignee: Gentoo's Team for Core System packages
URL: http://openi18n.org/cgi-bin/bugzilla/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-30 11:19 UTC by peteru
Modified: 2005-08-30 16:53 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description peteru 2005-08-30 11:19:37 UTC
generic/000_all_coreutils-i18n.patch in coreutils-5.3.0 breaks expand in such a
way that expand does not work properly when LANG="C" and it encounters a blank line.

Simple test:

$ echo | LANG="en_AU.UTF-8" expand

$ echo | LANG="C" expand
expand: input line is too long

This is caused by the following part of the patch:

@@ -352,7 +372,8 @@ expand (void)
                }
              else
                {
-                 column++;
+                 if (!ISCNTRL (c))
+                   column++;
                  if (!column)
                    error (EXIT_FAILURE, 0, _("input line is too long"));
                }

Furthermore, this failure is masked by generic/009_all_coreutils-tests.patch
which explicitly disables expand test and comments on the fact that it fails in
this manner.

This makes the expand command almost completely useless and can cause nasty
failures. For example, glibc build failure.


Reproducible: Always
Steps to Reproduce:
Comment 1 peteru 2005-08-30 11:57:40 UTC
This patch appears to fix the problem.

Rather than relying on integer overflow to indicate that a line is too long,
this code checks that column index has not reached the maximum signed value of
the variable. I decided to use the signed limit as opposed to unsigned limit
(the variable itself is unsigned) because the number is sufficiently large
enough and there is no risk of sign errors due to inadvertent casts.

diff -u expand.c expand.c~
--- expand.c    2005-08-31 04:47:34.000000000 +1000
+++ expand.c~   2005-08-31 03:30:54.000000000 +1000
@@ -374,7 +374,7 @@
                {
                  if (!ISCNTRL (c))
                    column++;
-                 if (!column)
+                 if (column >= INTMAX_MAX)
                    error (EXIT_FAILURE, 0, _("input line is too long"));
                }

Comment 2 SpanKY gentoo-dev 2005-08-30 16:31:56 UTC
or better yet, use the coreutils define UINTMAX_MAX
Comment 3 SpanKY gentoo-dev 2005-08-30 16:53:14 UTC
fixed in coreutils-5.3.0-r1, thanks