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:
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")); }
or better yet, use the coreutils define UINTMAX_MAX
fixed in coreutils-5.3.0-r1, thanks