GNU bug report logs - #61582
Different behaviour for "mkpart" command while using "kiB" and "KiB" units (case sensitivity)

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: parted; Reported by: Pavel Iatchenii <paveliatchenii@HIDDEN>; dated Fri, 17 Feb 2023 17:17:02 UTC; Maintainer for parted is bug-parted@HIDDEN.

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


Received: (at submit) by debbugs.gnu.org; 17 Feb 2023 17:16:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 17 12:16:54 2023
Received: from localhost ([127.0.0.1]:41469 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pT4Lt-0008VX-TK
	for submit <at> debbugs.gnu.org; Fri, 17 Feb 2023 12:16:54 -0500
Received: from lists.gnu.org ([209.51.188.17]:59050)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <paveliatchenii@HIDDEN>) id 1pT4G0-0008Il-OU
 for submit <at> debbugs.gnu.org; Fri, 17 Feb 2023 12:10:49 -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 <paveliatchenii@HIDDEN>)
 id 1pT4Fz-0007Cc-WF
 for bug-parted@HIDDEN; Fri, 17 Feb 2023 12:10:48 -0500
Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <paveliatchenii@HIDDEN>)
 id 1pT4Fx-0002Q5-Qx
 for bug-parted@HIDDEN; Fri, 17 Feb 2023 12:10:47 -0500
Received: by mail-oa1-x30.google.com with SMTP id
 586e51a60fabf-171872a792fso1806078fac.3
 for <bug-parted@HIDDEN>; Fri, 17 Feb 2023 09:10:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=CPXIfFqfhgs5GlCFo0jv+zmbq7ZhCBJ6p/zJ5iEuKY4=;
 b=PhSq1QCPb8DA0gQQhp13jvNn1KytiKvrvTydLVFFvDlJOX4sdnROQyvd7PY0KTlUx8
 fwec5xua+gSTYRPsM6AmwMHCoDzOLAnAusodqh8ibv8Hmpf5gWPkZRLRQ83P/IThUvh/
 /BJ4TO0DKun2/8XM1VSg+yv3eLPmJAgtPbPiQmCHPUtUSgOPICm86ebTOq0cxVfGrFCc
 eIQ2+WD+ke3uFUoFmICoAS3qeBpb1tGYjG4UV9jh7WByt9dWY9hWNSLaqdHjE/VA9RHn
 AG52RKOZquoc3m08tj9GIazUIBCxH16yz/ODykXLvo7En6Un460UIvfyeoFYevsl39+0
 6rwg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=CPXIfFqfhgs5GlCFo0jv+zmbq7ZhCBJ6p/zJ5iEuKY4=;
 b=giaLOkZTl4sFPtO6LWMFCgQJuaguS9gh4C4PXUI1A1o2U5ldtM6hvg2NhCmg7U/4Tt
 3ZaWkQSuiHzilgMNFG9MnnTdBcUBZcL9aWPkxsAb+VdiUu1upn+hkxSocW5UWJ0ZiX5m
 6HXjTNUhTDGiKNt85MUtZuvh+fKSXW4Tn1sWfFimmuyc4OLzHRmDKhc8cz8SJOnXHlLB
 8vDHSc8rSlWHeshJfJ2UWdtMp3DSdFcPtlmVf8ViCVyt0gK4vuX2qwqHSdd/9+EkXxO6
 WJohHVpCO0+HjcOKJ0PV6xA5qT/aFMNQzii/XrCMYSBPYXzte+Xh+sIhbK5CFrsnpuYt
 gt4A==
X-Gm-Message-State: AO0yUKUhNf49a5GoZfAZ8vN+9/hjrybdqsLT4oQFN5sOmdDdWOrHaLwm
 5kiaav2FQqgX/O9fP2mxNGWQCZRcK53u136Idu2NRUgMECE=
X-Google-Smtp-Source: AK7set8sgdJjOM1Qh8qAWb/lQuux5mxVrOpTn3jfatQvKbk4rqygjwvEiE2yhl/Er5z96SHlRemlJMTocjD3QvcpktY=
X-Received: by 2002:a05:6870:969e:b0:16e:8d0a:c6d6 with SMTP id
 o30-20020a056870969e00b0016e8d0ac6d6mr295099oaq.185.1676653842803; Fri, 17
 Feb 2023 09:10:42 -0800 (PST)
MIME-Version: 1.0
From: Pavel Iatchenii <paveliatchenii@HIDDEN>
Date: Fri, 17 Feb 2023 17:10:31 +0000
Message-ID: <CAEfs1nvywLKkiB-HR6hNLciJQiODFPRzqiYcNnBG=bEva=Cd=w@HIDDEN>
Subject: Different behaviour for "mkpart" command while using "kiB" and "KiB"
 units (case sensitivity)
To: bug-parted@HIDDEN
Content-Type: multipart/alternative; boundary="000000000000b6319a05f4e86442"
Received-SPF: pass client-ip=2001:4860:4864:20::30;
 envelope-from=paveliatchenii@HIDDEN; helo=mail-oa1-x30.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 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_FROM=0.001,
 HTML_MESSAGE=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.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 17 Feb 2023 12:16:53 -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: -2.3 (--)

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

Introduction
When you open man
<https://manpages.debian.org/unstable/parted/parted.8.en.html> page or gnu
<https://www.gnu.org/software/parted/manual/html_node/unit.html> documentat=
ion,
you may refer to "unit" command and think that "KiB" is a correct
interpretation of, whatever its name, 1024 bytes. And it actually works for
using this command as well as creating a single partition with "mkpart"
command. Then, there is a BIG one: you can=E2=80=99t create adjacent partit=
ions
while encountering a weird error:


*parted -s /dev/nvme1n1 mkpart primary 128KiB 28692352KiB mkpart primary
28692352KiB 29216640KiB*
*Error: You requested a partition from 29.4GB to 29.9GB (sectors
7173088..7304160).*
*The closest location we can manage is 29.4GB to 29.9GB (sectors
7173089..7304160).*

However, if you proceed with "unit" command as in documentation and keep
the case of "KiB", then partitions are created successfully:

*parted -s /dev/nvme1n1 unit KiB mkpart primary 128 28692352 mkpart primary
28692352 29216640*

Where could be the catch?

   1. The code of the above-mentioned "unit" command contains a static
   constant array of units. It looks like this and has "kiB" with lower cas=
e
   =E2=80=9Ck=E2=80=9D, though further down checks names without case sensi=
tivity.

*static const char* unit_names[] =3D {*
*    "s",*
*    "B",*
*    "kB",*
*    "MB",*
*    "GB",*
*    "TB",*
*    "compact",*
*    "cyl",*
*    "chs",*
*    "%",*
*    "kiB",*
*    "MiB",*
*    "GiB",*
*    "TiB"*
*};*


   1. There is adjustment to be called whenever the partition is created or
   resized. It looks like this and also checks for "kiB", though with case
   sensitivity this time.

*/* Return true, if str ends with [kMGTPEZY]iB, i.e. IEC units.  */*
*static bool*
*_string_ends_with_iec_unit(const char *str)*
*{*
*        /* 3 characters for the IEC unit and at least 1 digit */*
*        if (!str || strlen(str) < 4)*
*                return false;*

*        char const *p =3D str + strlen(str) - 3;*
*        return strchr ("kMGTPEZY", *p) && c_strcasecmp (p+1, "iB") =3D=3D =
0;*
*}*

*/* If the selected unit is one of kiB, MiB, GiB or TiB and the partition
is not*
* * only 1 sector long, then adjust the end so that it is one sector before
the*
* * given position. Also adjust range_end accordingly. Thus next partition
can*
* * start immediately after this one.*
* **
* * To be called after end sector is read from the user.*
* **
* * https://lists.gnu.org/archive/html/bug-parted/2011-10/msg00009.html
<https://lists.gnu.org/archive/html/bug-parted/2011-10/msg00009.html>*
* */*
*static void*
*_adjust_end_if_iec (PedSector* start, PedSector* end,*
*                    PedGeometry* range_end, char* end_input)*
*{*
*        ...*
*        if (_string_ends_with_iec_unit(end_input) || ...) {*
*                *end -=3D 1;*
*                range_end->start -=3D 1;*
*                range_end->end -=3D 1;*
*        }*
*}*


Suggestion
Even though units are parsed case-insensitively in most cases, it may be
crucial in other cases and lead to the original issue. As such, whether
this is a following ICE standard or archaeology, the documentation of
"parted" utility could clarify this point and eliminate such problems in
the future. Alternatively, both catches could be consistent with each other
and treat case sensitivity in the same manner, according to documentation.

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

<div dir=3D"ltr"><div class=3D"elementToProof gmail-ContentPasted0" style=
=3D"border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit=
;font-stretch:inherit;font-size:12pt;line-height:inherit;font-family:Calibr=
i,Arial,Helvetica,sans-serif;margin:0px;padding:0px;vertical-align:baseline=
;color:rgb(0,0,0)"><h2 style=3D"color:rgb(24,90,189);font-family:&quot;Cali=
bri Light&quot;;font-size:13pt;margin-left:2pt"><span style=3D"border:0px;f=
ont:inherit;margin:0px;padding:0px;vertical-align:baseline;color:inherit">I=
ntroduction</span></h2></div><div class=3D"elementToProof gmail-ContentPast=
ed0" style=3D"border:0px;font-variant-numeric:inherit;font-variant-east-asi=
an:inherit;font-stretch:inherit;font-size:12pt;line-height:inherit;font-fam=
ily:Calibri,Arial,Helvetica,sans-serif;margin:0px;padding:0px;vertical-alig=
n:baseline;color:rgb(0,0,0)">When you open=C2=A0<a href=3D"https://manpages=
.debian.org/unstable/parted/parted.8.en.html" title=3D"https://manpages.deb=
ian.org/unstable/parted/parted.8.en.html" id=3D"gmail-LPlnk149005" style=3D=
"border:0px;font:inherit;margin:0px;padding:0px;vertical-align:baseline">ma=
n</a>=C2=A0page or=C2=A0<a href=3D"https://www.gnu.org/software/parted/manu=
al/html_node/unit.html" title=3D"https://www.gnu.org/software/parted/manual=
/html_node/unit.html" id=3D"gmail-LPNoLPOWALinkPreview" style=3D"border:0px=
;font:inherit;margin:0px;padding:0px;vertical-align:baseline">gnu</a>=C2=A0=
documentation, you may refer to &quot;unit&quot; command and think that &qu=
ot;KiB&quot; is a correct interpretation of, whatever its name, 1024 bytes.=
 And it actually works for using this command as well as creating a single =
partition with &quot;mkpart&quot; command. Then, there is a BIG one: you ca=
n=E2=80=99t create adjacent partitions while encountering a weird error:<br=
></div><div class=3D"gmail-_Entity gmail-_EType_OWALinkPreview gmail-_EId_O=
WALinkPreview gmail-_EReadonly_1" style=3D"border:0px;font-variant-numeric:=
inherit;font-variant-east-asian:inherit;font-stretch:inherit;font-size:12px=
;line-height:inherit;margin:0px;padding:0px;vertical-align:baseline;color:r=
gb(0,0,0)"></div><br style=3D"color:rgb(0,0,0);font-size:12px"><div class=
=3D"elementToProof gmail-ContentPasted0" style=3D"border:0px;font-variant-n=
umeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;font-si=
ze:12pt;line-height:inherit;font-family:Calibri,Arial,Helvetica,sans-serif;=
margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0)"><br></div>=
<div class=3D"elementToProof gmail-ContentPasted0 gmail-ContentPasted1" sty=
le=3D"border:0px;font-variant-numeric:inherit;font-variant-east-asian:inher=
it;font-stretch:inherit;font-size:12pt;line-height:inherit;font-family:Cali=
bri,Arial,Helvetica,sans-serif;margin:0px;padding:0px;vertical-align:baseli=
ne;color:rgb(0,0,0)"><i>parted -s /dev/nvme1n1 mkpart primary 128KiB 286923=
52KiB mkpart primary 28692352KiB 29216640KiB</i><div class=3D"gmail-Content=
Pasted1" style=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-a=
lign:baseline;color:inherit"><i>Error: You requested a partition from 29.4G=
B to 29.9GB (sectors 7173088..7304160).</i></div><i>The closest location we=
 can manage is 29.4GB to 29.9GB (sectors 7173089..7304160).</i><br></div><d=
iv class=3D"elementToProof gmail-ContentPasted0 gmail-ContentPasted1" style=
=3D"border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit=
;font-stretch:inherit;font-size:12pt;line-height:inherit;font-family:Calibr=
i,Arial,Helvetica,sans-serif;margin:0px;padding:0px;vertical-align:baseline=
;color:rgb(0,0,0)"><br></div><div class=3D"elementToProof gmail-ContentPast=
ed0 gmail-ContentPasted1" style=3D"border:0px;font-variant-numeric:inherit;=
font-variant-east-asian:inherit;font-stretch:inherit;font-size:12pt;line-he=
ight:inherit;font-family:Calibri,Arial,Helvetica,sans-serif;margin:0px;padd=
ing:0px;vertical-align:baseline;color:rgb(0,0,0)">However, if you proceed w=
ith &quot;unit&quot; command as in documentation and keep the case of &quot=
;KiB&quot;, then partitions are created successfully:</div><div class=3D"el=
ementToProof gmail-ContentPasted0 gmail-ContentPasted1" style=3D"border:0px=
;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:=
inherit;font-size:12pt;line-height:inherit;font-family:Calibri,Arial,Helvet=
ica,sans-serif;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0=
,0)"><br></div><div class=3D"elementToProof gmail-ContentPasted0 gmail-Cont=
entPasted1" style=3D"border:0px;font-variant-numeric:inherit;font-variant-e=
ast-asian:inherit;font-stretch:inherit;font-size:12pt;line-height:inherit;f=
ont-family:Calibri,Arial,Helvetica,sans-serif;margin:0px;padding:0px;vertic=
al-align:baseline;color:rgb(0,0,0)"><span class=3D"gmail-ContentPasted2 gma=
il-ContentPasted3" style=3D"border:0px;font:inherit;margin:0px;padding:0px;=
vertical-align:baseline;display:inline"><i>parted -s /dev/nvme1n1=C2=A0unit=
 KiB mkpart primary 128 28692352 mkpart primary 28692352 29216640</i></span=
><br></div><div class=3D"elementToProof gmail-ContentPasted0 gmail-ContentP=
asted1" style=3D"border:0px;font-variant-numeric:inherit;font-variant-east-=
asian:inherit;font-stretch:inherit;font-size:12pt;line-height:inherit;font-=
family:Calibri,Arial,Helvetica,sans-serif;margin:0px;padding:0px;vertical-a=
lign:baseline;color:rgb(0,0,0)"><span class=3D"gmail-ContentPasted2 gmail-C=
ontentPasted3" style=3D"border:0px;font:inherit;margin:0px;padding:0px;vert=
ical-align:baseline;display:inline"><br></span></div><div class=3D"elementT=
oProof gmail-ContentPasted0 gmail-ContentPasted1" style=3D"border:0px;font-=
variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inheri=
t;font-size:12pt;line-height:inherit;font-family:Calibri,Arial,Helvetica,sa=
ns-serif;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0)"><=
h2 style=3D"color:rgb(24,90,189);font-family:&quot;Calibri Light&quot;;font=
-size:13pt;margin-left:2pt"><span class=3D"gmail-ContentPasted2 gmail-Conte=
ntPasted3 gmail-ContentPasted4" style=3D"border:0px;font:inherit;margin:0px=
;padding:0px;vertical-align:baseline;color:rgb(0,0,0)">Where could be the c=
atch?</span></h2><span class=3D"gmail-ContentPasted2 gmail-ContentPasted3 g=
mail-ContentPasted4" style=3D"border:0px;font:inherit;margin:0px;padding:0p=
x;vertical-align:baseline;display:inline"><div class=3D"gmail-ContentPasted=
4" style=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-align:b=
aseline;color:inherit"><ol><li><span style=3D"border:0px;font:inherit;margi=
n:0px;padding:0px;vertical-align:baseline;color:inherit">The code of the ab=
ove-mentioned &quot;unit&quot; command contains a static constant array of =
units. It looks like this and has &quot;kiB&quot; with lower case =E2=80=9C=
k=E2=80=9D, though further down checks names without case sensitivity.<br><=
/span></li></ol></div><div class=3D"gmail-ContentPasted4" style=3D"border:0=
px;font:inherit;margin:0px;padding:0px;vertical-align:baseline;color:inheri=
t"><i>static const char* unit_names[] =3D {</i></div><div class=3D"gmail-Co=
ntentPasted4" style=3D"border:0px;font:inherit;margin:0px;padding:0px;verti=
cal-align:baseline;color:inherit"><i>=C2=A0 =C2=A0 &quot;s&quot;,</i></div>=
<div class=3D"gmail-ContentPasted4" style=3D"border:0px;font:inherit;margin=
:0px;padding:0px;vertical-align:baseline;color:inherit"><i>=C2=A0 =C2=A0 &q=
uot;B&quot;,</i></div><div class=3D"gmail-ContentPasted4" style=3D"border:0=
px;font:inherit;margin:0px;padding:0px;vertical-align:baseline;color:inheri=
t"><i>=C2=A0 =C2=A0 &quot;kB&quot;,</i></div><div class=3D"gmail-ContentPas=
ted4" style=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-alig=
n:baseline;color:inherit"><i>=C2=A0 =C2=A0 &quot;MB&quot;,</i></div><div cl=
ass=3D"gmail-ContentPasted4" style=3D"border:0px;font:inherit;margin:0px;pa=
dding:0px;vertical-align:baseline;color:inherit"><i>=C2=A0 =C2=A0 &quot;GB&=
quot;,</i></div><div class=3D"gmail-ContentPasted4" style=3D"border:0px;fon=
t:inherit;margin:0px;padding:0px;vertical-align:baseline;color:inherit"><i>=
=C2=A0 =C2=A0 &quot;TB&quot;,</i></div><div class=3D"gmail-ContentPasted4" =
style=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-align:base=
line;color:inherit"><i>=C2=A0 =C2=A0 &quot;compact&quot;,</i></div><div cla=
ss=3D"gmail-ContentPasted4" style=3D"border:0px;font:inherit;margin:0px;pad=
ding:0px;vertical-align:baseline;color:inherit"><i>=C2=A0 =C2=A0 &quot;cyl&=
quot;,</i></div><div class=3D"gmail-ContentPasted4" style=3D"border:0px;fon=
t:inherit;margin:0px;padding:0px;vertical-align:baseline;color:inherit"><i>=
=C2=A0 =C2=A0 &quot;chs&quot;,</i></div><div class=3D"gmail-ContentPasted4"=
 style=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-align:bas=
eline;color:inherit"><i>=C2=A0 =C2=A0 &quot;%&quot;,</i></div><div class=3D=
"gmail-ContentPasted4" style=3D"border:0px;font:inherit;margin:0px;padding:=
0px;vertical-align:baseline;color:inherit"><i>=C2=A0 =C2=A0 &quot;kiB&quot;=
,</i></div><div class=3D"gmail-ContentPasted4" style=3D"border:0px;font:inh=
erit;margin:0px;padding:0px;vertical-align:baseline;color:inherit"><i>=C2=
=A0 =C2=A0 &quot;MiB&quot;,</i></div><div class=3D"gmail-ContentPasted4" st=
yle=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-align:baseli=
ne;color:inherit"><i>=C2=A0 =C2=A0 &quot;GiB&quot;,</i></div><div class=3D"=
gmail-ContentPasted4" style=3D"border:0px;font:inherit;margin:0px;padding:0=
px;vertical-align:baseline;color:inherit"><i>=C2=A0 =C2=A0 &quot;TiB&quot;<=
/i></div><div class=3D"gmail-ContentPasted4" style=3D"border:0px;font:inher=
it;margin:0px;padding:0px;vertical-align:baseline;color:inherit"><i>};</i><=
/div><div class=3D"gmail-ContentPasted4" style=3D"border:0px;font:inherit;m=
argin:0px;padding:0px;vertical-align:baseline;color:inherit"><br></div><ol =
start=3D"2"><li class=3D"gmail-ContentPasted4">There is adjustment to be ca=
lled whenever the partition is created or resized. It looks like this and a=
lso checks for &quot;kiB&quot;, though with case sensitivity this time.<br>=
</li></ol><div class=3D"gmail-ContentPasted4 gmail-ContentPasted5" style=3D=
"border:0px;font:inherit;margin:0px;padding:0px;vertical-align:baseline;col=
or:inherit"><i>/* Return true, if str ends with [kMGTPEZY]iB, i.e. IEC unit=
s. =C2=A0*/</i><div class=3D"gmail-ContentPasted5" style=3D"border:0px;font=
:inherit;margin:0px;padding:0px;vertical-align:baseline;color:inherit"><i>s=
tatic bool</i></div><div class=3D"gmail-ContentPasted5" style=3D"border:0px=
;font:inherit;margin:0px;padding:0px;vertical-align:baseline;color:inherit"=
><i>_string_ends_with_iec_unit(const char *str)</i></div><div class=3D"gmai=
l-ContentPasted5" style=3D"border:0px;font:inherit;margin:0px;padding:0px;v=
ertical-align:baseline;color:inherit"><i>{</i></div><div class=3D"gmail-Con=
tentPasted5" style=3D"border:0px;font:inherit;margin:0px;padding:0px;vertic=
al-align:baseline;color:inherit"><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* 3 charac=
ters for the IEC unit and at least 1 digit */</i></div><div class=3D"gmail-=
ContentPasted5" style=3D"border:0px;font:inherit;margin:0px;padding:0px;ver=
tical-align:baseline;color:inherit"><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!str=
 || strlen(str) &lt; 4)</i></div><div class=3D"gmail-ContentPasted5" style=
=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-align:baseline;=
color:inherit"><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 r=
eturn false;</i></div><div style=3D"border:0px;font:inherit;margin:0px;padd=
ing:0px;vertical-align:baseline;color:inherit"><i><br class=3D"gmail-Conten=
tPasted5"></i></div><div class=3D"gmail-ContentPasted5" style=3D"border:0px=
;font:inherit;margin:0px;padding:0px;vertical-align:baseline;color:inherit"=
><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 char const *p =3D str + strlen(str) - 3;</i=
></div><div class=3D"gmail-ContentPasted5" style=3D"border:0px;font:inherit=
;margin:0px;padding:0px;vertical-align:baseline;color:inherit"><i>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 return strchr (&quot;kMGTPEZY&quot;, *p) &amp;&amp; c_=
strcasecmp (p+1, &quot;iB&quot;) =3D=3D 0;</i></div><i>}</i><br></div><div =
class=3D"gmail-ContentPasted4 gmail-ContentPasted5" style=3D"border:0px;fon=
t:inherit;margin:0px;padding:0px;vertical-align:baseline;color:inherit"><br=
></div><div class=3D"gmail-ContentPasted4" style=3D"border:0px;font:inherit=
;margin:0px;padding:0px;vertical-align:baseline;color:inherit"><i>/* If the=
 selected unit is one of kiB, MiB, GiB or TiB and the partition is not</i><=
/div><div class=3D"gmail-ContentPasted4" style=3D"border:0px;font:inherit;m=
argin:0px;padding:0px;vertical-align:baseline;color:inherit"><i>=C2=A0* onl=
y 1 sector long, then adjust the end so that it is one sector before the</i=
></div><div class=3D"gmail-ContentPasted4" style=3D"border:0px;font:inherit=
;margin:0px;padding:0px;vertical-align:baseline;color:inherit"><i>=C2=A0* g=
iven position. Also adjust range_end accordingly. Thus next partition can</=
i></div><div class=3D"gmail-ContentPasted4" style=3D"border:0px;font:inheri=
t;margin:0px;padding:0px;vertical-align:baseline;color:inherit"><i>=C2=A0* =
start immediately after this one.</i></div><div class=3D"gmail-ContentPaste=
d4" style=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-align:=
baseline;color:inherit"><i>=C2=A0*</i></div><div class=3D"gmail-ContentPast=
ed4" style=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-align=
:baseline;color:inherit"><i>=C2=A0* To be called after end sector is read f=
rom the user.</i></div><div class=3D"gmail-ContentPasted4" style=3D"border:=
0px;font:inherit;margin:0px;padding:0px;vertical-align:baseline;color:inher=
it"><i>=C2=A0*</i></div><div class=3D"gmail-ContentPasted4" style=3D"border=
:0px;font:inherit;margin:0px;padding:0px;vertical-align:baseline;color:inhe=
rit"><i>=C2=A0* <a href=3D"https://lists.gnu.org/archive/html/bug-parted/20=
11-10/msg00009.html">https://lists.gnu.org/archive/html/bug-parted/2011-10/=
msg00009.html</a></i></div><div class=3D"gmail-ContentPasted4" style=3D"bor=
der:0px;font:inherit;margin:0px;padding:0px;vertical-align:baseline;color:i=
nherit"><i>=C2=A0*/</i></div><div class=3D"gmail-ContentPasted4" style=3D"b=
order:0px;font:inherit;margin:0px;padding:0px;vertical-align:baseline;color=
:inherit"><i>static void</i></div><div class=3D"gmail-ContentPasted4" style=
=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-align:baseline;=
color:inherit"><i>_adjust_end_if_iec (PedSector* start, PedSector* end,</i>=
</div><div class=3D"gmail-ContentPasted4" style=3D"border:0px;font:inherit;=
margin:0px;padding:0px;vertical-align:baseline;color:inherit"><i>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PedGeometry* ra=
nge_end, char* end_input)</i></div><div class=3D"gmail-ContentPasted4" styl=
e=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-align:baseline=
;color:inherit"><i>{</i></div><div class=3D"gmail-ContentPasted4" style=3D"=
border:0px;font:inherit;margin:0px;padding:0px;vertical-align:baseline;colo=
r:inherit"><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ...</i></div><div class=3D"gmail-=
ContentPasted4" style=3D"border:0px;font:inherit;margin:0px;padding:0px;ver=
tical-align:baseline;color:inherit"><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (_str=
ing_ends_with_iec_unit(end_input) || ...) {</i></div><div class=3D"gmail-Co=
ntentPasted4" style=3D"border:0px;font:inherit;margin:0px;padding:0px;verti=
cal-align:baseline;color:inherit"><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 *end -=3D 1;</i></div><div class=3D"gmail-ContentPasted4"=
 style=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-align:bas=
eline;color:inherit"><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 range_end-&gt;start -=3D 1;</i></div><div class=3D"gmail-ContentPast=
ed4" style=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-align=
:baseline;color:inherit"><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 range_end-&gt;end -=3D 1;</i></div><div class=3D"gmail-ContentPa=
sted4" style=3D"border:0px;font:inherit;margin:0px;padding:0px;vertical-ali=
gn:baseline;color:inherit"><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 }</i></div></span=
></div><div class=3D"elementToProof gmail-ContentPasted0 gmail-ContentPaste=
d1" style=3D"border:0px;font-variant-numeric:inherit;font-variant-east-asia=
n:inherit;font-stretch:inherit;font-size:12pt;line-height:inherit;font-fami=
ly:Calibri,Arial,Helvetica,sans-serif;margin:0px;padding:0px;vertical-align=
:baseline;color:rgb(0,0,0)"><span class=3D"gmail-ContentPasted2 gmail-Conte=
ntPasted3 gmail-ContentPasted4" style=3D"border:0px;font:inherit;margin:0px=
;padding:0px;vertical-align:baseline;display:inline"><i>}</i><br></span></d=
iv><div class=3D"elementToProof gmail-ContentPasted0 gmail-ContentPasted1" =
style=3D"border:0px;font-variant-numeric:inherit;font-variant-east-asian:in=
herit;font-stretch:inherit;font-size:12pt;line-height:inherit;font-family:C=
alibri,Arial,Helvetica,sans-serif;margin:0px;padding:0px;vertical-align:bas=
eline;color:rgb(0,0,0)"><span class=3D"gmail-ContentPasted2 gmail-ContentPa=
sted3 gmail-ContentPasted4" style=3D"border:0px;font:inherit;margin:0px;pad=
ding:0px;vertical-align:baseline;display:inline"><i><br></i></span></div><d=
iv class=3D"elementToProof gmail-ContentPasted0 gmail-ContentPasted1" style=
=3D"border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit=
;font-stretch:inherit;font-size:12pt;line-height:inherit;font-family:Calibr=
i,Arial,Helvetica,sans-serif;margin:0px;padding:0px;vertical-align:baseline=
;color:rgb(0,0,0)"><span class=3D"gmail-ContentPasted2 gmail-ContentPasted3=
 gmail-ContentPasted4" style=3D"border:0px;font:inherit;margin:0px;padding:=
0px;vertical-align:baseline;display:inline"><i><br></i></span></div><div cl=
ass=3D"elementToProof gmail-ContentPasted0 gmail-ContentPasted1" style=3D"b=
order:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font=
-stretch:inherit;font-size:12pt;line-height:inherit;font-family:Calibri,Ari=
al,Helvetica,sans-serif;margin:0px;padding:0px;vertical-align:baseline;colo=
r:rgb(0,0,0)"><span class=3D"gmail-ContentPasted2 gmail-ContentPasted3 gmai=
l-ContentPasted4" style=3D"border:0px;font:inherit;margin:0px;padding:0px;v=
ertical-align:baseline;display:inline"><h2 style=3D"color:rgb(24,90,189);fo=
nt-family:&quot;Calibri Light&quot;;font-size:13pt;margin-left:2pt">Suggest=
ion</h2></span></div><div class=3D"elementToProof gmail-ContentPasted0 gmai=
l-ContentPasted1" style=3D"border:0px;font-variant-numeric:inherit;font-var=
iant-east-asian:inherit;font-stretch:inherit;font-size:12pt;line-height:inh=
erit;font-family:Calibri,Arial,Helvetica,sans-serif;margin:0px;padding:0px;=
vertical-align:baseline;color:rgb(0,0,0)"><span class=3D"gmail-ContentPaste=
d2 gmail-ContentPasted3 gmail-ContentPasted4" style=3D"border:0px;font:inhe=
rit;margin:0px;padding:0px;vertical-align:baseline;display:inline"><span cl=
ass=3D"gmail-ContentPasted6" style=3D"border:0px;font:inherit;margin:0px;pa=
dding:0px;vertical-align:baseline;color:inherit">Even though units are pars=
ed case-insensitively in most cases, it may be crucial in other cases and l=
ead to the original issue. As such, whether this is a following ICE standar=
d or archaeology, the documentation of &quot;parted&quot; utility could cla=
rify this point and eliminate such problems in the future. Alternatively, b=
oth catches could be consistent with each other and treat case sensitivity =
in the same manner, according to documentation.</span></span></div></div>

--000000000000b6319a05f4e86442--




Acknowledgement sent to Pavel Iatchenii <paveliatchenii@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-parted@HIDDEN. Full text available.
Report forwarded to bug-parted@HIDDEN:
bug#61582; Package parted. 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: Fri, 17 Feb 2023 17:30:02 UTC

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