<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>104286</bug_id>
          
          <creation_ts>2005-08-30 11:19 0000</creation_ts>
          <short_desc>coreutils-5.3.0-i18n-0.1.patch breaks expand</short_desc>
          <delta_ts>2005-08-30 16:53:14 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Core system</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          <bug_file_loc>http://openi18n.org/cgi-bin/bugzilla/show_bug.cgi?id=103</bug_file_loc>
          
          
          <priority>P2</priority>
          <bug_severity>blocker</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>gentoo.bugzilla@peteru.dnsalias.net</reporter>
          <assigned_to>base-system@gentoo.org</assigned_to>
          

      

      
          <long_desc isprivate="0">
            <who>gentoo.bugzilla@peteru.dnsalias.net</who>
            <bug_when>2005-08-30 11:19:37 0000</bug_when>
            <thetext>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=&quot;C&quot; and it encounters a blank line.

Simple test:

$ echo | LANG=&quot;en_AU.UTF-8&quot; expand

$ echo | LANG=&quot;C&quot; 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, _(&quot;input line is too long&quot;));
                }

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:</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gentoo.bugzilla@peteru.dnsalias.net</who>
            <bug_when>2005-08-30 11:57:40 0000</bug_when>
            <thetext>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 &gt;= INTMAX_MAX)
                    error (EXIT_FAILURE, 0, _(&quot;input line is too long&quot;));
                }

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2005-08-30 16:31:56 0000</bug_when>
            <thetext>or better yet, use the coreutils define UINTMAX_MAX</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2005-08-30 16:53:14 0000</bug_when>
            <thetext>fixed in coreutils-5.3.0-r1, thanks</thetext>
          </long_desc>
      
    </bug>

</bugzilla>