GNU bug report logs - #12966
cut: Problems with overlapping, open-ended ranges

Previous Next

Package: coreutils;

Reported by: "Marcel Böhme" <hawkie <at> web.de>

Date: Fri, 23 Nov 2012 08:14:01 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Meyering <jim <at> meyering.net>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 12966 <at> debbugs.gnu.org, Marcel Böhme <hawkie <at> web.de>
Subject: bug#12966: cut: Problems with overlapping, open-ended ranges
Date: Sat, 24 Nov 2012 18:01:17 +0100
Bernhard Voelker wrote:

> On 11/24/2012 08:11 AM, Jim Meyering wrote:
>
>> Subject: [PATCH] cut: interpret "-b3-,2-" like "-b2-", not like "-b3-"
>
> Isn't it the other way round? I.e. "-b3-,2-" has already been working
> correctly.
>
> - Subject: [PATCH] cut: interpret "-b3-,2-" like "-b2-", not like "-b3-"
> + Subject: [PATCH] cut: interpret "-b2-,3-" like "-b2-", not like "-b3-"

It most definitely is.
Good catch.  I've dropped the double quotes, too.
They were useful in an earlier version that had a space after each -b,
but now they add useless clutter.

>> diff --git a/NEWS b/NEWS
>> index 15fddd4..284525e 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -14,6 +14,10 @@ GNU coreutils NEWS -*- outline -*-
>>    Instead, cut now fails and emits an appropriate diagnostic.
>>    [This bug was present in "the beginning".]
>>
>> +  cut now handles overlapping right-open-ended ranges properly.  Before,
>> +  it would interpret "-b3-,2-" like "-b3-".  Now it's treated like "-b2-".
>> +  [This bug was present in "the beginning".]
>> +
>
> Likewise.

Yep.

>> diff --git a/THANKS.in b/THANKS.in
>> index 016a41e..3080cd3 100644
>> --- a/THANKS.in
>> +++ b/THANKS.in
>> @@ -367,6 +367,7 @@ Marc Haber mh+debian-bugs <at> zugschlus.de
>>  Marc Mengel                         mengel <at> fnal.gov
>>  Marc Lehman                         schmorp <at> schmorp.de
>>  Marc Olzheim                        marcolz <at> stack.nl
>> +Marcel Böhme                        hawkie <at> web.de
>>  Marco Franzen                       Marco.Franzen <at> Thyron.com
>>  Marcus Brinkmann                    http://www.marcus-brinkmann.de
>>  Marcus Daniels                      marcus <at> ee.pdx.edu
>
> That change will conflict with Padraig's pending patch for
> http://bugs.gnu.org/12959.

Yes.  Now that he's pushed that, I've simply removed the above
delta from my change set.

> Otherwise, the patch looks good.

Thanks for the review.

> BTW: interestingly, the i18n patch of openSuSE downstream
> already had such a fix included for ages (line 215):
> https://build.opensuse.org/package/view_file?file=coreutils-i18n.patch&package=coreutils&project=Base%3ASystem

Oh.  I wish that whoever fixed that had let us know.
For reference, here's the actual patch:

               if (!rhs_specified)
                 {
                   /* 'n-'.  From 'initial' to end of line. */
-                  eol_range_start = initial;
+                  if (eol_range_start == 0 ||
+                      (eol_range_start != 0 && eol_range_start > initial))
+                    eol_range_start = initial;
                   field_found = true;
                 }

BTW, I'll bet there's a static analysis tool that would
warn about its redundant test, "eol_range_start != 0"




This bug report was last modified 12 years and 176 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.