GNU bug report logs - #17800
seq weirdness with -0

Previous Next

Package: coreutils;

Reported by: Rasmus Villemoes <rv <at> rasmusvillemoes.dk>

Date: Wed, 18 Jun 2014 11:57:03 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17800 in the body.
You can then email your comments to 17800 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#17800; Package coreutils. (Wed, 18 Jun 2014 11:57:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rasmus Villemoes <rv <at> rasmusvillemoes.dk>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 18 Jun 2014 11:57:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rasmus Villemoes <rv <at> rasmusvillemoes.dk>
To: bug-coreutils <at> gnu.org
Subject: seq weirdness with -0
Date: Wed, 18 Jun 2014 11:41:43 +0200
$ ./seq --version | head -1
seq (GNU coreutils) 8.22.119-8a51b

./seq -0 n works fine when n is a single digit:

$ ./seq --separator=, -0 5
-0,1,2,3,4,5

But something weird happens when one uses a number >= 10:

$ ./seq --separator=, -0 10
-0,-1,-2,-3,-4,-5,-6,-7,-8,-9,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,/0,/1,/2,/3,/4,/5,/6,/7,/8,/9,00,01,02,03,04,05,06,07,08,09,10

[It also happens without the --separator; I just use that to save
vertical space.] This smells of ASCII, and looking at the code, the
problem is very likely to be the seq_fast/incr functions. I don't know
what the simplest fix is, though.

Rasmus





Information forwarded to bug-coreutils <at> gnu.org:
bug#17800; Package coreutils. (Wed, 18 Jun 2014 12:04:01 GMT) Full text and rfc822 format available.

Message #8 received at 17800 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Rasmus Villemoes <rv <at> rasmusvillemoes.dk>
Cc: 17800 <at> debbugs.gnu.org
Subject: Re: bug#17800: seq weirdness with -0
Date: Wed, 18 Jun 2014 13:03:37 +0100
On 06/18/2014 10:41 AM, Rasmus Villemoes wrote:
> $ ./seq --version | head -1
> seq (GNU coreutils) 8.22.119-8a51b
> 
> ./seq -0 n works fine when n is a single digit:
> 
> $ ./seq --separator=, -0 5
> -0,1,2,3,4,5
> 
> But something weird happens when one uses a number >= 10:
> 
> $ ./seq --separator=, -0 10
> -0,-1,-2,-3,-4,-5,-6,-7,-8,-9,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,/0,/1,/2,/3,/4,/5,/6,/7,/8,/9,00,01,02,03,04,05,06,07,08,09,10
> 
> [It also happens without the --separator; I just use that to save
> vertical space.] This smells of ASCII, and looking at the code, the
> problem is very likely to be the seq_fast/incr functions. I don't know
> what the simplest fix is, though.

Ouch. I see the issue. Fix on the way...

thanks!
Pádraig.





Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Wed, 18 Jun 2014 13:40:02 GMT) Full text and rfc822 format available.

Notification sent to Rasmus Villemoes <rv <at> rasmusvillemoes.dk>:
bug acknowledged by developer. (Wed, 18 Jun 2014 13:40:03 GMT) Full text and rfc822 format available.

Message #13 received at 17800-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Rasmus Villemoes <rv <at> rasmusvillemoes.dk>
Cc: 17800-done <at> debbugs.gnu.org
Subject: Re: bug#17800: seq weirdness with -0
Date: Wed, 18 Jun 2014 14:39:03 +0100
[Message part 1 (text/plain, inline)]
On 06/18/2014 01:03 PM, Pádraig Brady wrote:
> On 06/18/2014 10:41 AM, Rasmus Villemoes wrote:
>> $ ./seq --version | head -1
>> seq (GNU coreutils) 8.22.119-8a51b
>>
>> ./seq -0 n works fine when n is a single digit:
>>
>> $ ./seq --separator=, -0 5
>> -0,1,2,3,4,5
>>
>> But something weird happens when one uses a number >= 10:
>>
>> $ ./seq --separator=, -0 10
>> -0,-1,-2,-3,-4,-5,-6,-7,-8,-9,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,/0,/1,/2,/3,/4,/5,/6,/7,/8,/9,00,01,02,03,04,05,06,07,08,09,10
>>
>> [It also happens without the --separator; I just use that to save
>> vertical space.] This smells of ASCII, and looking at the code, the
>> problem is very likely to be the seq_fast/incr functions. I don't know
>> what the simplest fix is, though.
> 
> Ouch. I see the issue. Fix on the way...

Fast path avoidance logic updated in the attached.

thanks!
Pádraig.

[seq-0.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#17800; Package coreutils. (Wed, 18 Jun 2014 15:48:01 GMT) Full text and rfc822 format available.

Message #16 received at 17800 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: 17800 <at> debbugs.gnu.org, P <at> draigBrady.com, rv <at> rasmusvillemoes.dk
Subject: Re: bug#17800: seq weirdness with -0
Date: Wed, 18 Jun 2014 17:47:34 +0200
On 06/18/2014 03:39 PM, Pádraig Brady wrote:
> Subject: [PATCH] seq: fix incorrect output with start or end of -0

LGTM - although I'm still wondering what's the use case
behind a negative Null "-0". ;-)

Thanks & have a nice day,
Berny





Information forwarded to bug-coreutils <at> gnu.org:
bug#17800; Package coreutils. (Wed, 18 Jun 2014 19:12:01 GMT) Full text and rfc822 format available.

Message #19 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rasmus Villemoes <rv <at> rasmusvillemoes.dk>
To: bug-coreutils <at> gnu.org
Cc: Bernhard Voelker <mail <at> bernhard-voelker.de>, P <at> draigBrady.com
Subject: Re: bug#17800: seq weirdness with -0
Date: Wed, 18 Jun 2014 21:10:50 +0200
Bernhard Voelker <mail <at> bernhard-voelker.de> writes:

> On 06/18/2014 03:39 PM, Pádraig Brady wrote:
>> Subject: [PATCH] seq: fix incorrect output with start or end of -0
>
> LGTM - although I'm still wondering what's the use case
> behind a negative Null "-0". ;-)

I agree it is unlikely anyone would write -0 explicitly, but one could
imagine a script doing

    seq -$n $m | ...

where the preceding code sets $n and $m to be some non-negative integers.

Thanks for the quick response.

Rasmus





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 17 Jul 2014 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 244 days ago.

Previous Next


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