Subject: seq incorrectly(?) pads output when last parameter magnitude larger than last printed number

From: Nicolas Boichat <[email-masked]>
Date: Sat, 22 Mar 2025 14:42:41 +0100

Hi, (retry sending without multipart/alternative)

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,

Nicolas