GNU bug report logs - #79369
seq generates wrong sequences for big numbers

Previous Next

Package: coreutils;

Reported by: <ondra007.tom <at> seznam.cz>

Date: Tue, 2 Sep 2025 14:01:02 UTC

Severity: normal

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

To reply to this bug, email your comments to 79369 AT debbugs.gnu.org.
There is no need to reopen the bug first.

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#79369; Package coreutils. (Tue, 02 Sep 2025 14:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to <ondra007.tom <at> seznam.cz>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 02 Sep 2025 14:01:02 GMT) Full text and rfc822 format available.

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

From: <ondra007.tom <at> seznam.cz>
To: <bug-coreutils <at> gnu.org>
Subject: seq generates wrong sequences for big numbers
Date: Tue, 02 Sep 2025 14:11:28 +0200 (CEST)
[Message part 1 (text/plain, inline)]
It looks like seq for integers bigger than 2^64 sometimes generate wrong 
results. There are few examples of wrong output I have found:


$ seq 18446744073709551617 inf | head -3

18446744073709551616
18446744073709551617
18446744073709551618





$  seq 10000000000000000000000000000 inf | head -3


9999999999999999999731564544
9999999999999999999731564545
9999999999999999999731564546





$  seq -1000000000000000000000000 0 | head -3


-1000000000000000000000000
-1000000000000000000000000
-1000000000000000000000000




It is similar to bug #75994 which reports the same issue but only for "-w"
option.
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#79369; Package coreutils. (Tue, 02 Sep 2025 15:54:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: ondra007.tom <at> seznam.cz, 79369 <at> debbugs.gnu.org
Subject: Re: bug#79369: seq generates wrong sequences for big numbers
Date: Tue, 2 Sep 2025 16:52:50 +0100
[Message part 1 (text/plain, inline)]
On 02/09/2025 13:11, ondra007.tom <at> seznam.cz wrote:
> It looks like seq for integers bigger than 2^64 sometimes generate wrong
> results. There are few examples of wrong output I have found:
> 
> 
> $ seq 18446744073709551617 inf | head -3
> 
> 18446744073709551616
> 18446744073709551617
> 18446744073709551618
> 
> 
> 
> 
> 
> $  seq 10000000000000000000000000000 inf | head -3
> 
> 
> 9999999999999999999731564544
> 9999999999999999999731564545
> 9999999999999999999731564546

We can improve for the above 2 cases anyway,
with something like the attached.

Large magnitude negative start values are still problematic.

cheers,
Padraig
[seq-large-start.patch (text/x-patch, attachment)]

Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Tue, 02 Sep 2025 19:54:02 GMT) Full text and rfc822 format available.

Notification sent to <ondra007.tom <at> seznam.cz>:
bug acknowledged by developer. (Tue, 02 Sep 2025 19:54:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: ondra007.tom <at> seznam.cz, 79369-done <at> debbugs.gnu.org
Subject: Re: bug#79369: seq generates wrong sequences for big numbers
Date: Tue, 2 Sep 2025 20:53:31 +0100
On 02/09/2025 16:52, Pádraig Brady wrote:
> On 02/09/2025 13:11, ondra007.tom <at> seznam.cz wrote:
>> It looks like seq for integers bigger than 2^64 sometimes generate wrong
>> results. There are few examples of wrong output I have found:
>>
>>
>> $ seq 18446744073709551617 inf | head -3
>>
>> 18446744073709551616
>> 18446744073709551617
>> 18446744073709551618
>>
>>
>>
>>
>>
>> $  seq 10000000000000000000000000000 inf | head -3
>>
>>
>> 9999999999999999999731564544
>> 9999999999999999999731564545
>> 9999999999999999999731564546
> 
> We can improve for the above 2 cases anyway,
> with something like the attached.
> 
> Large magnitude negative start values are still problematic.

Ok I pushed that with a test included:https://github.com/coreutils/coreutils/commit/701416709
Marking this as done.

thanks,
Padraig




Information forwarded to bug-coreutils <at> gnu.org:
bug#79369; Package coreutils. (Wed, 03 Sep 2025 04:20:02 GMT) Full text and rfc822 format available.

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

From: Collin Funk <collin.funk1 <at> gmail.com>
To: 79369 <at> debbugs.gnu.org
Cc: P <at> draigBrady.com, ondra007.tom <at> seznam.cz
Subject: Re: bug#79369: seq generates wrong sequences for big numbers
Date: Tue, 02 Sep 2025 21:19:42 -0700
[Message part 1 (text/plain, inline)]
Pádraig Brady <P <at> draigBrady.com> writes:

>> We can improve for the above 2 cases anyway,
>> with something like the attached.
>> Large magnitude negative start values are still problematic.
>
> Ok I pushed that with a test included:https://github.com/coreutils/coreutils/commit/701416709
> Marking this as done.

Thanks for the fix.

Just pushed this tiny patch to fix a 'make syntax-check' failure.

Collin

[0001-maint-avoid-syntax-check-failure-from-previous-commi.patch (text/x-patch, attachment)]

This bug report was last modified 10 days ago.

Previous Next


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