bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9420: cut: --output-delimiter ignored in combination with -c


From: Jim Meyering
Subject: bug#9420: cut: --output-delimiter ignored in combination with -c
Date: Thu, 01 Sep 2011 21:34:45 +0200

Pádraig Brady wrote:

> On 09/01/2011 07:33 PM, Philipp Thomas wrote:
>>
>> Cut from older coreutils (at least until 7.1) honoured --output-delimiter in
>> combination with -c.  Newer coreutils don't, i.e. with the older cut you get
>>
>> $ echo 12 | cut --output-delimiter=X -c1,2
>> 1X2
>>
>> And with the newer ones
>>
>> $ echo 12 | cut --output-delimiter=X -c1,2
>> 12
>>
>> Is this a regression or was this a deliberate change that wasn't documented?
>
> Looks like a regression introduced with the i18n patch,
> so I'm closing this here.
>
> $ echo 12 | cut --output-delimiter=X -c1,2
> 12
> $ echo 12 | LANG=C cut --output-delimiter=X -c1,2
> 1X2

Wondering how that could happen, given our test suite,
I realized that we take care to set LC_ALL=C for most tests.
At least for cut, I'm changing that.  Now we'll run each test with
LC_ALL=C, and again (when possible) with e.g., LC_ALL=fr_FR.UTF-8.

>From ea8295673ebe81b8b0a64bc35a497a44ea419934 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 1 Sep 2011 21:30:10 +0200
Subject: [PATCH] tests: exercise distro-added multibyte code paths in cut

* tests/misc/cut: Repeat each test using a multibyte locale,
if the configure-time test found one.
---
 tests/misc/cut |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/tests/misc/cut b/tests/misc/cut
index c905ba9..7c1450b 100755
--- a/tests/misc/cut
+++ b/tests/misc/cut
@@ -23,6 +23,10 @@ use strict;
 # Turn off localization of executable's output.
 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;

+my $mb_locale = $ENV{LOCALE_FR_UTF8};
+! defined $mb_locale || $mb_locale eq 'none'
+  and $mb_locale = 'C';
+
 my $prog = 'cut';
 my $try = "Try \`$prog --help' for more information.\n";
 my $from_1 = "$prog: fields and positions are numbered from 1\n$try";
@@ -156,6 +160,22 @@ my @Tests =
   ['big-unbounded-f', '--output-d=:', '-f1234567890-', {IN=>''}, {OUT=>''}],
  );

+if ($mb_locale ne 'C')
+  {
+    # Duplicate each test vector, appending "-mb" to the test name and
+    # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we
+    # provide coverage for the distro-added multi-byte code paths.
+    my @new;
+    foreach my $t (@Tests)
+      {
+        my @new_t = @$t;
+        my $test_name = shift @new_t;
+        push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
+      }
+    push @Tests, @new;
+  }
+
+
 @Tests = triple_test address@hidden;

 my $save_temps = $ENV{DEBUG};
--
1.7.7.rc0.362.g5a14





reply via email to

[Prev in Thread] Current Thread [Next in Thread]