GNU bug report logs - #12959
"seq -w -1e-3 9" misaligned

Previous Next

Package: coreutils;

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

Date: Thu, 22 Nov 2012 10:51:01 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 12959 in the body.
You can then email your comments to 12959 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#12959; Package coreutils. (Thu, 22 Nov 2012 10:51:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Marcel Böhme" <hawkie <at> web.de>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 22 Nov 2012 10:51:02 GMT) Full text and rfc822 format available.

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

From: "Marcel Böhme" <hawkie <at> web.de>
To: bug-coreutils <at> gnu.org
Subject: "seq -w -1e-3 9" misaligned
Date: Thu, 22 Nov 2012 11:49:05 +0100 (CET)
Hi,

While the output of (1) "seq -w -1e-2 9" prints the width as expected, the output of (2) "seq -w -1e-3 9" does not:
 (1) vs. (2)
-0.01 | -0.001
00.99 | 0.999
01.99 | 1.999
02.99 | 2.999
03.99 | 3.999
04.99 | 4.999
05.99 | 5.999
06.99 | 6.999
07.99 | 7.999
08.99 | 8.999

Similarly, see "seq -w -1e2 -98" vs. "seq -w -1e3 -998".

Can you kindly confirm that the bug was introduced 4 years ago in the following commit: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=86e4b778b148bdd82395fdc312ce8d937f303e33

Best regards,
 Marcel





Information forwarded to bug-coreutils <at> gnu.org:
bug#12959; Package coreutils. (Thu, 22 Nov 2012 11:00:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Marcel Böhme <hawkie <at> web.de>
Cc: 12959 <at> debbugs.gnu.org
Subject: Re: bug#12959: "seq -w -1e-3 9" misaligned
Date: Thu, 22 Nov 2012 10:58:27 +0000
On 11/22/2012 10:49 AM, Marcel Böhme wrote:
> Hi,
>
> While the output of (1) "seq -w -1e-2 9" prints the width as expected, the output of (2) "seq -w -1e-3 9" does not:
>   (1) vs. (2)
> -0.01 | -0.001
> 00.99 | 0.999
> 01.99 | 1.999
> 02.99 | 2.999
> 03.99 | 3.999
> 04.99 | 4.999
> 05.99 | 5.999
> 06.99 | 6.999
> 07.99 | 7.999
> 08.99 | 8.999
>
> Similarly, see "seq -w -1e2 -98" vs. "seq -w -1e3 -998".
>
> Can you kindly confirm that the bug was introduced 4 years ago in the following commit: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=86e4b778b148bdd82395fdc312ce8d937f303e33

Confirmed:

$ ~/git/coreutils/src/seq -w -1e-3 1
-0.001
0.999

$ ~/git/coreutils/src/seq -w -.001 1
-0.001
00.999

I'll have a look.

thanks,
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#12959; Package coreutils. (Fri, 23 Nov 2012 04:26:02 GMT) Full text and rfc822 format available.

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

From: "Marcel Böhme" <hawkie <at> web.de>
To: "Pádraig Brady" <P <at> draigBrady.com>
Cc: 12959 <at> debbugs.gnu.org
Subject: Aw: bug#12959: "seq -w -1e-3 9" misaligned
Date: Fri, 23 Nov 2012 05:23:21 +0100 (CET)
Hi Pádraig,

The problem seems to be related to the computation of ret.width for arguments with exponent in method scan_arg. Apparently, the ret.precision is handled in the presence of an exponent while the ret.width is not.

More evidence:
$ seq -w 1e3 1e5 | head -2
1000
1001
$ seq -w 1e3 1e5 | tail -2
99999
100000

$ seq -w -1e-1 1
-00.1
000.9
$ seq -w -0.1 1
-0.1
00.9

Thanks!

Best regards,
 Marcel

On 11/22/2012 11:58 AM, Pádraig Brady wrote:

On 11/22/2012 10:49 AM, Marcel Böhme wrote:
> Hi,
>
> While the output of (1) "seq -w -1e-2 9" prints the width as expected, the output of (2) "seq -w -1e-3 9" does not:
> (1) vs. (2)
> -0.01 | -0.001
> 00.99 | 0.999
> 01.99 | 1.999
> 02.99 | 2.999
> 03.99 | 3.999
> 04.99 | 4.999
> 05.99 | 5.999
> 06.99 | 6.999
> 07.99 | 7.999
> 08.99 | 8.999
>
> Similarly, see "seq -w -1e2 -98" vs. "seq -w -1e3 -998".
>
> Can you kindly confirm that the bug was introduced 4 years ago in the following commit: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=86e4b778b148bdd82395fdc312ce8d937f303e33

Confirmed:

$ ~/git/coreutils/src/seq -w -1e-3 1
-0.001
0.999

$ ~/git/coreutils/src/seq -w -.001 1
-0.001
00.999

I'll have a look.

thanks,
Pádraig.










Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Fri, 23 Nov 2012 09:31:02 GMT) Full text and rfc822 format available.

Notification sent to "Marcel Böhme" <hawkie <at> web.de>:
bug acknowledged by developer. (Fri, 23 Nov 2012 09:31:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Marcel Böhme <hawkie <at> web.de>
Cc: 12959-done <at> debbugs.gnu.org
Subject: Re: bug#12959: "seq -w -1e-3 9" misaligned
Date: Fri, 23 Nov 2012 09:04:54 +0000
[Message part 1 (text/plain, inline)]
On 11/22/2012 10:58 AM, Pádraig Brady wrote:
> On 11/22/2012 10:49 AM, Marcel Böhme wrote:
>> Hi,
>>
>> While the output of (1) "seq -w -1e-2 9" prints the width as expected, the output of (2) "seq -w -1e-3 9" does not:
>>   (1) vs. (2)
>> -0.01 | -0.001
>> 00.99 | 0.999
>> 01.99 | 1.999
>> 02.99 | 2.999
>> 03.99 | 3.999
>> 04.99 | 4.999
>> 05.99 | 5.999
>> 06.99 | 6.999
>> 07.99 | 7.999
>> 08.99 | 8.999
>>
>> Similarly, see "seq -w -1e2 -98" vs. "seq -w -1e3 -998".
>>
>> Can you kindly confirm that the bug was introduced 4 years ago in the following commit: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=86e4b778b148bdd82395fdc312ce8d937f303e33
>
> Confirmed:
>
> $ ~/git/coreutils/src/seq -w -1e-3 1
> -0.001
> 0.999
>
> $ ~/git/coreutils/src/seq -w -.001 1
> -0.001
> 00.999

The attached should fix this.

thanks,
Pádraig.
[seq-w-e.diff (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#12959; Package coreutils. (Fri, 23 Nov 2012 10:11:01 GMT) Full text and rfc822 format available.

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

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: 12959 <at> debbugs.gnu.org, P <at> draigBrady.com, hawkie <at> web.de
Subject: Re: bug#12959: "seq -w -1e-3 9" misaligned
Date: Fri, 23 Nov 2012 11:08:41 +0100
On 11/23/2012 10:04 AM, Pádraig Brady wrote:
> 
> The attached should fix this.

> * src/seq.c (scan_arg): Calculate the width more accurately
> for numbers specified using scientific notation.
> * tests/misc/seq.pl: Add test cases for cases that were mishandled

s/$/./

> * NEWS: Mention the fix.
> * THANKS.in: Reported by Marcel Böhme

s/$/./

And as it's a bug, we should mention it:
  http://bugs.gnu.org/12959

Other than that, the patch looks good.
Thanks.

Have a nice day,
Berny






Information forwarded to bug-coreutils <at> gnu.org:
bug#12959; Package coreutils. (Fri, 23 Nov 2012 10:15:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: hawkie <at> web.de, 12959 <at> debbugs.gnu.org
Subject: Re: bug#12959: "seq -w -1e-3 9" misaligned
Date: Fri, 23 Nov 2012 10:13:02 +0000
On 11/23/2012 10:08 AM, Bernhard Voelker wrote:
> On 11/23/2012 10:04 AM, Pádraig Brady wrote:
>>
>> The attached should fix this.
>
>> * src/seq.c (scan_arg): Calculate the width more accurately
>> for numbers specified using scientific notation.
>> * tests/misc/seq.pl: Add test cases for cases that were mishandled
>
> s/$/./
>
>> * NEWS: Mention the fix.
>> * THANKS.in: Reported by Marcel Böhme
>
> s/$/./
>
> And as it's a bug, we should mention it:
>    http://bugs.gnu.org/12959
>
> Other than that, the patch looks good.
> Thanks.

Thanks for the review!
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#12959; Package coreutils. (Fri, 23 Nov 2012 11:48:01 GMT) Full text and rfc822 format available.

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

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: hawkie <at> web.de, 12959 <at> debbugs.gnu.org
Subject: Re: bug#12959: "seq -w -1e-3 9" misaligned
Date: Fri, 23 Nov 2012 12:46:03 +0100

On 11/23/2012 11:13 AM, Pádraig Brady wrote:
> Thanks for the review!
> Pádraig.

No worries, you're welcome.

For what it's worth, you may also add an integer test case
like "seq -w -1e3 1" which is/was also affected by this bug:

  $ seq -w -1e3 1 | head -n 2
  -1000
  -999

Have a nice day,
Berny




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 21 Dec 2012 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 126 days ago.

Previous Next


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