GNU bug report logs -
#77179
seq incorrectly(?) pads output when last parameter magnitude larger than last printed number
Previous Next
To reply to this bug, email your comments to 77179 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#77179
; Package
coreutils
.
(Sat, 22 Mar 2025 14:58:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Nicolas Boichat <nicolas <at> boichat.ch>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Sat, 22 Mar 2025 14:58:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
Version: seq (GNU coreutils) 9.6; OS: Archlinux, x86-64
When adding `-w` parameter, we want numbers to be padded with leading 0s,
e.g. this looks correct:
$ seq -w 0 5 10
00
05
10
However, the behaviour is perhaps incorrect when the last printed number
magnitude is lower than the last parameter, e.g:
$ seq -w 0 6 10
00
06
would probably be more correct with this output:
0
6
The manual makes no promise about this ("Print all numbers with the same
width, by padding with leading zeros"), but it's still a bit odd to add a
superfluous 0.
Also, it is especially confusing because, on the other hand, the precision
of the last parameter is ignored, as if it was just a bound that played no
role in formatting:
$ seq 0 5 10.00001
0
5
10
While
$ seq 0.0000 5 10
0.0000
5.0000
10.0000
Side note, a solution would also need to make sure that this still works:
$ seq -w 0 5 12
00
05
10
Thanks,
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#77179
; Package
coreutils
.
(Sat, 22 Mar 2025 19:19:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 77179 <at> debbugs.gnu.org (full text, mbox):
On 22/03/2025 12:36, Nicolas Boichat wrote:
> Hi,
>
> Version: seq (GNU coreutils) 9.6; OS: Archlinux, x86-64
>
> When adding `-w` parameter, we want numbers to be padded with leading 0s,
> e.g. this looks correct:
> $ seq -w 0 5 10
> 00
> 05
> 10
>
> However, the behaviour is perhaps incorrect when the last printed number
> magnitude is lower than the last parameter, e.g:
> $ seq -w 0 6 10
> 00
> 06
> would probably be more correct with this output:
> 0
> 6
>
> The manual makes no promise about this ("Print all numbers with the same
> width, by padding with leading zeros"), but it's still a bit odd to add a
> superfluous 0.
>
> Also, it is especially confusing because, on the other hand, the precision
> of the last parameter is ignored, as if it was just a bound that played no
> role in formatting:
> $ seq 0 5 10.00001
> 0
> 5
> 10
>
> While
> $ seq 0.0000 5 10
> 0.0000
> 5.0000
> 10.0000
>
> Side note, a solution would also need to make sure that this still works:
> $ seq -w 0 5 12
> 00
> 05
> 10
Yes we could do better here,though there are many edge cases as you've noted.
I suspect though that -w currently suffices for the
vast majority of cases it's needed for.
thanks,
Pádraig
This bug report was last modified 88 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.