X-Loop: help-debbugs@HIDDEN
Subject: bug#77179: seq incorrectly(?) pads output when last parameter magnitude larger than last printed number
Resent-From: Nicolas Boichat <nicolas@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Sat, 22 Mar 2025 14:58:03 +0000
Resent-Message-ID: <handler.77179.B.174265547319863 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 77179
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords:
To: 77179 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-coreutils@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.174265547319863
(code B ref -1); Sat, 22 Mar 2025 14:58:03 +0000
Received: (at submit) by debbugs.gnu.org; 22 Mar 2025 14:57:53 +0000
Received: from localhost ([127.0.0.1]:44551 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1tw0IK-0005AD-NE
for submit <at> debbugs.gnu.org; Sat, 22 Mar 2025 10:57:53 -0400
Received: from lists.gnu.org ([2001:470:142::17]:57154)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <nicolas.boichat@HIDDEN>)
id 1tvy5e-0002xR-LI
for submit <at> debbugs.gnu.org; Sat, 22 Mar 2025 08:36:39 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <nicolas.boichat@HIDDEN>)
id 1tvy5Y-00028N-6T
for bug-coreutils@HIDDEN; Sat, 22 Mar 2025 08:36:32 -0400
Received: from mail-io1-f45.google.com ([209.85.166.45])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <nicolas.boichat@HIDDEN>)
id 1tvy5U-0007hh-85
for bug-coreutils@HIDDEN; Sat, 22 Mar 2025 08:36:31 -0400
Received: by mail-io1-f45.google.com with SMTP id
ca18e2360f4ac-85ae4dc67e5so143044639f.2
for <bug-coreutils@HIDDEN>; Sat, 22 Mar 2025 05:36:27 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1742646986; x=1743251786;
h=to:subject:message-id:date:from:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=Y8O5+vfE58QdKRVWZlyF0ta96di3Us7tOn2o6tySHXA=;
b=Z5fVaujCTbFIUfdbqr9ONOwhmdtv8dFJiaz40W9F9dNXeI8JFYQEfeNj2b+aMZtukO
NsGDkPMDaH2PjJxxNF/qZ6WrkHtDSkKb9jl66TgRPTvoxAUHr0UBj5AN0Fa4Iv28UTYS
FGsjOvqce+WL3HqxhpSKAFdJquRPDAMcU29sLYcxAlA64SLN61tiMJKvXZr9sJMdQIho
uQfuvzQdMXi2vAZtFeojNzxr5NTVulbgcwmZFVNUmJST/ezl8bgs0X8BQ28rCGf3s+jF
iBfvGiOf1u7D6qqee2l+DbbiavDgl7DzYwUZan2DzP4FlWQl3DApUNmlD1se8sDL+nou
2tTQ==
X-Gm-Message-State: AOJu0Yw+ZTZ62erevCecJkJJMAqcioAdGuCiCYmEvgrIK7j7ChXOhuto
pieVvRXOXC0Y3HPMmSA/TwylNvu24nRl3Cp0iuYQom3CzlEDsIKPpipPrVSSSfAB/O1xecrj2gh
OX2HMdagnP+z0yNYjHvX5T+2lmKVsh3eo
X-Gm-Gg: ASbGncsWozKqMouososVcLKWzoq/j87Cs5n0/lfdUL11nDTZogcMcOF274f99mqysKu
TPJ5tF4tjKYdxWcDgbro/mFafGJpmluVlWLxdYItaSTjvenJh4JCLPn7+nV0HzIP3n6BgXj0x6L
jSTsPTjC9B5N+g2r7c2+x1l80l
X-Google-Smtp-Source: AGHT+IEQogqY/YDAsGjvY96Sor5F+m2OvZ+L2q6Fh4ey8sJU1O/BitvTSpVcMv493vVQBGAtFqRR4dWQKfoC8dAXskY=
X-Received: by 2002:a05:6e02:1908:b0:3d0:47cf:869c with SMTP id
e9e14a558f8ab-3d59617bb79mr67523395ab.19.1742646985550; Sat, 22 Mar 2025
05:36:25 -0700 (PDT)
MIME-Version: 1.0
From: Nicolas Boichat <nicolas@HIDDEN>
Date: Sat, 22 Mar 2025 13:36:13 +0100
X-Gm-Features: AQ5f1JouEsjaWtl1Be2xmoMcw1i4G0lvwPgKtIagumnBIIO0tzbrfTELgfiQ8GQ
Message-ID: <CAM6NUi7bdtfnSnXxwp6qQ9H3Nk5cETixed9GLmQBaKcYTsuLCQ@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000008af7840630ed9e22"
Received-SPF: pass client-ip=209.85.166.45;
envelope-from=nicolas.boichat@HIDDEN; helo=mail-io1-f45.google.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9,
FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001,
RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Mailman-Approved-At: Sat, 22 Mar 2025 10:57:48 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)
--0000000000008af7840630ed9e22
Content-Type: text/plain; charset="UTF-8"
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,
--0000000000008af7840630ed9e22
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><div>Hi,</div><div><br></div><div>Version=
: seq (GNU coreutils) 9.6; OS: Archlinux, x86-64</div><div><div><br></div><=
div><div>When adding `-w` parameter, we want numbers to be padded with lead=
ing 0s, e.g. this looks correct:</div><div>$ seq -w 0 5 10</div><div>00</di=
v><div>05</div><div>10</div><div><br></div><div>However, the behaviour is p=
erhaps incorrect when the last printed number magnitude is lower than the l=
ast parameter, e.g:</div><div><div>$ seq -w 0 6 10</div>00</div><div>06</di=
v><div>would probably be more correct with this output:</div><div>0</div><d=
iv>6</div><div><br></div><div>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.</div><div><br></div=
><div>Also, it is especially confusing because, on the other hand, the prec=
ision of the last parameter is ignored, as if it was just a bound that play=
ed no role in formatting:</div><div>$ seq 0 5 10.00001</div><div>0</div><di=
v>5</div><div>10</div><div><br></div><div>While=C2=A0</div><div>$ seq 0.000=
0 5 10<br>0.0000<br>5.0000<br>10.0000</div><div><br></div><div>Side note, a=
solution would also need to make sure that this still works:</div><div>$ s=
eq -w 0 5 12</div><div>00</div><div>05</div><div>10</div><div><br></div><di=
v>Thanks,<br></div></div></div></div>
</div>
--0000000000008af7840630ed9e22--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Nicolas Boichat <nicolas@HIDDEN> Subject: bug#77179: Acknowledgement (seq incorrectly(?) pads output when last parameter magnitude larger than last printed number) Message-ID: <handler.77179.B.174265547319863.ack <at> debbugs.gnu.org> References: <CAM6NUi7bdtfnSnXxwp6qQ9H3Nk5cETixed9GLmQBaKcYTsuLCQ@HIDDEN> X-Gnu-PR-Message: ack 77179 X-Gnu-PR-Package: coreutils Reply-To: 77179 <at> debbugs.gnu.org Date: Sat, 22 Mar 2025 14:58:03 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-coreutils@HIDDEN If you wish to submit further information on this problem, please send it to 77179 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 77179: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77179 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN
Subject: bug#77179: seq incorrectly(?) pads output when last parameter magnitude larger than last printed number
Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady <P@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Sat, 22 Mar 2025 19:19:01 +0000
Resent-Message-ID: <handler.77179.B77179.174267113126521 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77179
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords:
To: Nicolas Boichat <nicolas@HIDDEN>, 77179 <at> debbugs.gnu.org
Received: via spool by 77179-submit <at> debbugs.gnu.org id=B77179.174267113126521
(code B ref 77179); Sat, 22 Mar 2025 19:19:01 +0000
Received: (at 77179) by debbugs.gnu.org; 22 Mar 2025 19:18:51 +0000
Received: from localhost ([127.0.0.1]:45497 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1tw4Ms-0006th-RV
for submit <at> debbugs.gnu.org; Sat, 22 Mar 2025 15:18:51 -0400
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:42089)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <pixelbeat@HIDDEN>)
id 1tw4Mq-0006sw-AU
for 77179 <at> debbugs.gnu.org; Sat, 22 Mar 2025 15:18:48 -0400
Received: by mail-wr1-x432.google.com with SMTP id
ffacd0b85a97d-3913d129c1aso2188499f8f.0
for <77179 <at> debbugs.gnu.org>; Sat, 22 Mar 2025 12:18:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1742671122; x=1743275922; darn=debbugs.gnu.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:to:subject:user-agent:mime-version:date:message-id
:sender:from:to:cc:subject:date:message-id:reply-to;
bh=jhUj3eG2DRLf7Q8Wg4TGvRVEzb2f7s0cBNUD/eJSIeY=;
b=akaOpTFZRD1Q1y0L5gF0TZ1hNUOvEeqBREwAznE7XewTnxzeAiTZrq1jTWeoltprMd
4QIGuwTZU+xU2i8++wdNMEzzvRL9xRUVY7faIg3B2vlchq8+ClT5Fk3UZ6X8a4FLgxW/
pUakWbKkXhK64xtPH97irI9hUtZkzt2m4tixGjETkba+6Z78yICyY6TWP+W0q0JOlYzh
UfWOxybQqKWExb63W9laG8eBU1M70yKhkLwBJD5DUdT3gVMuaun3dVgOCf8/ozS/XQbV
Q0BDrg7aft1FpwcoLv8XY1LpPRsDlV/6Bgshhjd4HiOuauluWzFmr+z1+5rE/+Ve2/EI
F7RA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1742671122; x=1743275922;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:to:subject:user-agent:mime-version:date:message-id
:sender:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=jhUj3eG2DRLf7Q8Wg4TGvRVEzb2f7s0cBNUD/eJSIeY=;
b=Ko2hlp2etmM8b8hQ6zUJ3wtAgIUNxWhjadf/HPN5nUNivtUKT7Z13ZiQ2v5iIjjf4t
9w+6p3xWT0sRvrosaPVThx4vcsUmmsD5QNzT5VlH8T5yd4QZKrPhFzjIuChUfYWGSknG
J+IrCyaZORtf4upZl8t3rXvECobb7kVjc5Bk9JWsy9mleGr36egn4J02zCkKKNYiDAVz
4hHh7jV5h0LcTTbMl7KquQCh3gzGHQfuPBXmYvS3Nrz0NoqeqylIUEasdnP2OPhqRYVE
ogJZh2HNLlzQTSoOiu3E1iCjgyw6EPrvSN0eFhxILFeGfB87yotmEQLmEJCqlESESknU
QLbA==
X-Forwarded-Encrypted: i=1;
AJvYcCWJYfv3S6ZQmW7NwHucfqXhMj8h9u4HxqP5jEV67t57B8tMVQxoSwpbfhXF3xNHGwAFJpu6dw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzX5Qm5hUw+iPoovGELvL5rEEXQtlSjawVVueb7f3+/isb/O0CJ
OREbnV8PMOS+OAdxGsRK1be4fs16zaLMgQuvmX2/fxhqax01qsWwxvLrlojk
X-Gm-Gg: ASbGncv6B9mVRl3dhmM0D+3sRo4q8tQaJErYra3qh604MX0NaYFwYCJoxl03ZmsdUj5
z70Poo5b24SUZh8sXYcMLeA27m9R3s0+jHI1uE6VsTJ+gZJ3nZ9J8UPTFd7PRhtWz1zkcn7039v
6OgxQMVxMTqw70XtsLR9jjIRnQUbNwa2TCQumPaTTzt+Y1P/WXucMagS8wjf4HVcGSjT94cuh27
SgVWjx0F1np3zIXGkMcI8Y7juvMP2ScV6sKsp7qf06Pb2BeH/GkFMUCykP1DS7uLzkKVlT7lGzP
Qw8LCt55cInFJ0Tbf8co+o5gM45qWrLl7Lxs+4ufGuZFg1C5OEElYthSa8VeeWbAkWNTtl1pvP4
uU4v6pwxuQQDYZH7Tun40ORY8
X-Google-Smtp-Source: AGHT+IFWMfUpiqcjlmYlgjI5xm9kGqOxpB3PCM35441CaqUUXnBF3UxSOsJ8RajGdI5mytmM3yO+Hg==
X-Received: by 2002:a5d:584f:0:b0:38d:e0a9:7e5e with SMTP id
ffacd0b85a97d-399795567ebmr10444310f8f.6.1742671121684;
Sat, 22 Mar 2025 12:18:41 -0700 (PDT)
Received: from [192.168.1.31]
(86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146])
by smtp.googlemail.com with ESMTPSA id
5b1f17b1804b1-43d4fd18621sm65187455e9.12.2025.03.22.12.18.40
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Sat, 22 Mar 2025 12:18:41 -0700 (PDT)
Message-ID: <48768f92-9939-4687-8b3c-95147758491d@HIDDEN>
Date: Sat, 22 Mar 2025 19:18:40 +0000
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird Beta
References: <CAM6NUi7bdtfnSnXxwp6qQ9H3Nk5cETixed9GLmQBaKcYTsuLCQ@HIDDEN>
Content-Language: en-US
From: =?UTF-8?Q?P=C3=A1draig?= Brady <P@HIDDEN>
In-Reply-To: <CAM6NUi7bdtfnSnXxwp6qQ9H3Nk5cETixed9GLmQBaKcYTsuLCQ@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
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
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.