GNU bug report logs - #76070
Subject: seq, hexadecimal args and equal width

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Reported by: Alexandre Lacoste <a.lacoste.r1996@HIDDEN>; dated Wed, 5 Feb 2025 14:47:02 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 5 Feb 2025 14:46:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 05 09:46:13 2025
Received: from localhost ([127.0.0.1]:49261 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tfgfN-00067y-28
	for submit <at> debbugs.gnu.org; Wed, 05 Feb 2025 09:46:13 -0500
Received: from lists.gnu.org ([2001:470:142::17]:55184)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <a.lacoste.r1996@HIDDEN>)
 id 1tfdaO-0001qh-NW
 for submit <at> debbugs.gnu.org; Wed, 05 Feb 2025 06:28:53 -0500
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 <a.lacoste.r1996@HIDDEN>)
 id 1tfdaE-00035t-NJ
 for bug-coreutils@HIDDEN; Wed, 05 Feb 2025 06:28:45 -0500
Received: from mail-vs1-xe32.google.com ([2607:f8b0:4864:20::e32])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <a.lacoste.r1996@HIDDEN>)
 id 1tfdaC-0006lq-Ru
 for bug-coreutils@HIDDEN; Wed, 05 Feb 2025 06:28:42 -0500
Received: by mail-vs1-xe32.google.com with SMTP id
 ada2fe7eead31-4aff1c57377so478842137.0
 for <bug-coreutils@HIDDEN>; Wed, 05 Feb 2025 03:28:38 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1738754917; x=1739359717; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=yuKG0uMMy+PQK47Vt1x4EPEGkZrE3uTHA4xowHP/cVo=;
 b=j5svXkCMv1Utv8lPFQm7JVgTvw0Sizy+BOYaftqmDP7Oq60ccgpAK5qJGfFMXp6u1B
 S3zGc7S6VJTPI3xTcy0bbktkO2ka/x2wCfw58VRLdt9Pb8bRHrGdylMRRXS2RytN8Q3P
 p/Zr3b9oM3BGA7U1VhvM7lbIuYjdm+S/29Uzq/pVxWvTk9CPDxazQ0EmXezqu4rhH3kT
 jhcBweSORgMA/Uy+njmmi/vDdq1xnwNZAy2O6+MiQp/2XMbC4g5108W/eOR+8mwB74v+
 jwzTKUSIjwQBhW5KxEqwtcbUj2an6sOKvQF2FCEg9N1k6Jdj3w7P76gkSFcoVsM6nEQV
 ubxA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1738754917; x=1739359717;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=yuKG0uMMy+PQK47Vt1x4EPEGkZrE3uTHA4xowHP/cVo=;
 b=nHo8CaJV1wnFgmjHVkSCaSQybKPKfwsxewlCj9VYuAPdClH8RAhYiMcrbimdh9gAsx
 Ote0Ejvc4WZ54UhRcgiDh1UcP7/wICQfupwkT9DNJWP8ro70paLg4/ZVEa/Kit9rM/eD
 BRKlUJjAtv26DvAAhjT4OyE1mUfXq3zEK32bA7gs4KSEHjh33+M31XLuxokOiRmngOxv
 FVV8qscOFHB1oFjeaRIvNqmFQBaUyIEObGHwX00F2bZ06ywByUp66V1YUf3ozOzD3r7s
 E0NkI89laQ6FeNJRgOZXAjHE9qPfBnlqejtGeKssCXAKFSrSKwmhKFraFdIRhtQCZ3Ji
 +AYw==
X-Gm-Message-State: AOJu0YzYXLBlOgdWICRrv1wAVMrfwv0aimVrDXiENhRmw5j5OBXmHV6G
 h9qdprf/bzjymzftfVvN7Rb1acnIfpwf9S8SegBTYUT9ns83MGTIQA4rXQT4SIxZNkPjs7S2fmK
 65OjQEoLFv9G1dwJ49M83RlP4Od4/5KN+
X-Gm-Gg: ASbGncsw2FEA+AJPpxbwXhQPfVrveX0dL6tnAGRRBJH7CUcIAWbB+nGkWT6QbIInVti
 zeagvnCyqNzlafKoxH7Eh14rIoAZcVBaTAESlVaipHrUW7VPG+g/3bZAOcusaj1I2A6BDwxg=
X-Google-Smtp-Source: AGHT+IH9//pLZpoA9ZleKaWyLRyVOFr02u1JGlD6BcxkWL94zsMxd/g/b8KJ4OmnWKPM5tEt4nrcw3biGVSVpyfV0CI=
X-Received: by 2002:a67:f849:0:b0:4b5:c302:37b3 with SMTP id
 ada2fe7eead31-4ba08083149mr5049730137.5.1738754917553; Wed, 05 Feb 2025
 03:28:37 -0800 (PST)
MIME-Version: 1.0
From: Alexandre Lacoste <a.lacoste.r1996@HIDDEN>
Date: Wed, 5 Feb 2025 12:28:18 +0100
X-Gm-Features: AWEUYZm1MpqvwdRp4v-rVaWjFRMOInUCw2egs4sOOZmerzaEvjryhvBLvXYVMX4
Message-ID: <CAGegUEAMwJJtR7vnjgBehbwrP27ZN4kDZ5J6ub65wM4ym+O=mQ@HIDDEN>
Subject: Subject: seq, hexadecimal args and equal width
To: bug-coreutils@HIDDEN
Content-Type: multipart/alternative; boundary="000000000000366186062d636ded"
Received-SPF: pass client-ip=2607:f8b0:4864:20::e32;
 envelope-from=a.lacoste.r1996@HIDDEN; helo=mail-vs1-xe32.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001,
 LOTS_OF_MONEY=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  There is a bug in seq. The equal-width option does not work
    with hexadecimal arguments. For example: $❯ seq -w 0x02 0x01 0x10 2 3 4
    5 6 7 8 9 10 11 12 13 14 15 16 $> seq -w 0x09.1 0.1 0x10 9,0625 9,1625 9,2625
    9,3625 9,4625 9,5625 9,6625 9,7625 9,8625 9,9625 10,0625 10,1625 10,2625
   10,3625 ... ... [...] 
 
 Content analysis details:   (1.2 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (a.lacoste.r1996[at]gmail.com)
  0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
                             in digit (a.lacoste.r1996[at]gmail.com)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
  1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2001:470:142:0:0:0:0:17 listed in]
                             [list.dnswl.org]
  0.0 HTML_MESSAGE           BODY: HTML included in message
  0.0 LOTS_OF_MONEY          Huge... sums of money
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Wed, 05 Feb 2025 09:46:11 -0500
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.2 (/)

--000000000000366186062d636ded
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

 There is a bug in seq. The equal-width option does not work with
hexadecimal arguments. For example:

$=E2=9D=AF seq -w 0x02 0x01 0x10
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$> seq -w 0x09.1 0.1 0x10
9,0625
9,1625
9,2625
9,3625
9,4625
9,5625
9,6625
9,7625
9,8625
9,9625
10,0625
10,1625
10,2625
10,3625
...
...
...

In the scan_arg function, ret.width is always set to 0 when the argument
is hexadecimal. Hexadecimal numbers are excluded on purpose, by this if:

    seq.c:181:  if (! arg[strcspn (arg, "xX")] && isfinite (ret.value))

This causes that for both integer and floating-point hexadecimal numbers,
only the default width and precision are assigned. As a result, later in
the 'get_default_format' function, this if condition is never entered:

    seq.c:371:  if (prec !=3D INT_MAX && last.precision !=3D INT_MAX)

Resulting in an output format of different width.

As a solution to this problem, I recommend modifying the scan_arg function
to also consider cases with hexadecimal (whether integer or floating-point
hexadecimal) in order to assign them the corresponding width and precision
values. That is the source of the issue.

I hope we can find a suitable solution soon. It is a pleasure to help. Best
regards!

--000000000000366186062d636ded
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">
<font size=3D"2"><span style=3D"font-size:11pt">There is a bug in seq. The =
equal-width option does not work with<br></span></font><div><font size=3D"2=
"><span style=3D"font-size:11pt">
hexadecimal arguments. For example:</span><br></font></div><div><font size=
=3D"2"><br></font></div><div>$=E2=9D=AF seq -w 0x02 0x01 0x10<br>2<br>3<br>=
4<br>5<br>6<br>7<br>8<br>9<br>10<br>11<br>12<br>13<br>14<br>15<br>16<br>$&g=
t; seq -w 0x09.1 0.1 0x10<br>9,0625<br>9,1625<br>9,2625<br>9,3625<br>9,4625=
<br>9,5625<br>9,6625<br>9,7625<br>9,8625<br>9,9625<br>10,0625<br>10,1625<br=
>10,2625<br>10,3625<br>...<br>...<br>...</div><div><br></div><div>
<font size=3D"2"><span style=3D"font-size:11pt">In the scan_arg function, r=
et.width is always set to 0 when the argument<br>
is hexadecimal. Hexadecimal numbers are excluded on purpose, by this if:<br=
><br>
=C2=A0=C2=A0=C2=A0 seq.c:181:=C2=A0 if (! arg[strcspn (arg, &quot;xX&quot;)=
] &amp;&amp; isfinite (ret.value))</span></font> <br></div><div><br></div><=
div>
<font size=3D"2"><span style=3D"font-size:11pt">This causes that for both=
=20
integer and floating-point hexadecimal numbers, only the default width=20
and precision are assigned. As a result, later in the=20
&#39;get_default_format&#39; function, this if condition is never entered:<=
/span></font></div><div><font size=3D"2"><span style=3D"font-size:11pt"><br=
></span></font></div><div>=C2=A0=C2=A0=C2=A0 <font size=3D"2"><span style=
=3D"font-size:11pt">seq.c:371:=C2=A0 if (prec !=3D INT_MAX &amp;&amp; last.=
precision !=3D INT_MAX)</span></font>=20

</div><div><br></div><div>Resulting in an output format of different width.=
</div><div><br></div><div>
As a solution to this problem, I recommend modifying the <code>scan_arg</co=
de> function to also consider cases with hexadecimal (whether integer or fl=
oating-point hexadecimal)
in order to assign them the corresponding width and precision values. That =
is the source of the issue. <br></div><div><br></div><div>
I hope we can find a suitable solution soon. It is a pleasure to help. Best=
 regards!

</div><div><br></div><div><br></div><div><br></div><div><br></div><div>
<br></div><br></div>

--000000000000366186062d636ded--




Acknowledgement sent to Alexandre Lacoste <a.lacoste.r1996@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#76070; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 5 Feb 2025 15:00:03 UTC

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