From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id B50EB193CD; Fri, 28 Nov 2025 21:35:35 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 34C71193A6; Fri, 28 Nov 2025 21:35:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 Received: from fout-b2-smtp.messagingengine.com (fout-b2-smtp.messagingengine.com [202.12.124.145]) by atuin.qyliss.net (Postfix) with ESMTPS id 4A905193A4 for ; Fri, 28 Nov 2025 21:35:32 +0000 (UTC) Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id AB3A51D00771; Fri, 28 Nov 2025 16:35:29 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Fri, 28 Nov 2025 16:35:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1764365729; x=1764452129; bh=hpZLmGxIPb 5t8HgUdYWktMDEgD28LKOCwuYITBFnWek=; b=jwcJtrmxMcUC3yte6td0Dz3gFw hjz5y/SWSiyvAaQl9oWMLwpDMgFhhouJv5ENLGbuZb/P6rWbaDv2tKhBjn1Qf5+4 cdH7KXoXgxotWLKVuNjpZ3RRi5dZTd6+g7Ay99Djv+EFo8ShoEReqEFhhpMGlAQh KslI7OTFI5RhoR0dncGMH9RV3JoahzDVwnLJCJFEzozsOmXTHJUMSMUqaEjvnF04 deSB76Q80PuK1kT9gBrIO5zOWaoeM55fZK0AaOQQoMjcYcs5bWJoNfMXxDpo4JPU SpFB1/bdQq7tZ7MMm1bYkeGK5fF1FYTv1OIFEmjhbJ+OpEP2PiewcmSNnFTg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1764365729; x=1764452129; bh=hpZLmGxIPb5t8HgUdYWktMDEgD28LKOCwuY ITBFnWek=; b=WVxfnx1WmvXzDp897bT9/vqYM9PHemxZNFA24AryN92T5WSIes8 75gcwZe/nx1fKZ1bT4N+dCxYNOS7nmPpDUya2mFLsdFkKlP/k9K7QTYFsebbudH7 bg5GtLi89PvonG/XPkuO04a1t8HeS6tjoEx8GFdf+7xC1d35pMf3r1b454EqVTok UYaAGaG+6kZ5nPSM8pKV106BAyHn4HROR64J5FOAM+E6kZFLpCMShL8AXZfbaQAv GYoG0A7naAv0Z2sNDYIab8a5ZG+/0vBOfQSiSEdXjM2sTxblpj2GrEuIqDMYXPCA A2Bw3Rwld0H82coHKK4RJC8JqvyinVUXvkQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvhedtkeejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesghdtsfertddtjeenucfhrhhomheptehlhihsshgr ucftohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepjeduue evteegledvieegleetvdejfeefkeefudetleffiefhkeetvdeiuddugfeinecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrg drihhspdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthho peguvghmihhosggvnhhouhhrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepuggvvhgvlh esshhpvggtthhruhhmqdhoshdrohhrgh X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 28 Nov 2025 16:35:29 -0500 (EST) Received: by fw12.qyliss.net (Postfix, from userid 1000) id 299982DB36CC; Fri, 28 Nov 2025 22:35:13 +0100 (CET) Date: Fri, 28 Nov 2025 22:35:13 +0100 From: Alyssa Ross To: Demi Marie Obenour Subject: Re: [PATCH v2] scripts/make-gpt.sh: allow setting partition size Message-ID: References: <20251128132227.243596-2-hi@alyssa.is> <87ms45oo6b.fsf@alyssa.is> <373ef2eb-d230-431a-a22c-1a83348d5075@gmail.com> <87jyz9onmc.fsf@alyssa.is> <08f97c52-d6e4-424a-99dc-f29f37515fcb@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gcwyu4m2vtocukc7" Content-Disposition: inline In-Reply-To: <08f97c52-d6e4-424a-99dc-f29f37515fcb@gmail.com> Message-ID-Hash: KFZBFKV3J7F6PCP63XDKDF33HBEVUWG7 X-Message-ID-Hash: KFZBFKV3J7F6PCP63XDKDF33HBEVUWG7 X-MailFrom: hi@alyssa.is X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: devel@spectrum-os.org X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --gcwyu4m2vtocukc7 Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH v2] scripts/make-gpt.sh: allow setting partition size MIME-Version: 1.0 On Fri, Nov 28, 2025 at 04:31:21PM -0500, Demi Marie Obenour wrote: > On 11/28/25 16:26, Alyssa Ross wrote: > > Demi Marie Obenour writes: > > > >> On 11/28/25 16:14, Alyssa Ross wrote: > >>> Demi Marie Obenour writes: > >>> > >>>> On 11/28/25 08:22, Alyssa Ross wrote: > >>>>> We want non-minimally-sized partitions to leave space for updates. > >>>>> All such partitions will also be labelled, so we can just add anoth= er > >>>>> optional field at the end. > >>>>> > >>>>> Since we don't parse partition specifications in sh, we can't keep a > >>>>> running total any more, so instead we just go through the table at = the > >>>>> end and add up all the sizes, taking advantage of our knowledge that > >>>>> the size will always be the last thing in each line in our tables. > >>>>> > >>>>> Signed-off-by: Alyssa Ross > >>>>> Message-ID: <20251127174054.2056835-2-hi@alyssa.is> > > (snip) > > >>>>> # Keep 1MiB free at the start, and 1MiB free at the end. > >>>>> -gptBytes=3D$((ONE_MiB * 2)) > >>>>> -for partition; do > >>>>> - sizeMiB=3D"$(sizeMiB "${partition%%:*}")" > >>>>> - table=3D"$table${nl}size=3D${sizeMiB}MiB,$(awk -f "$scriptsDir/sf= disk-field.awk" -v partition=3D"$partition")" > >>>>> - gptBytes=3D"$((gptBytes + sizeMiB * ONE_MiB))" > >>>>> -done > >>>>> +gptMiB=3D2 > >>>>> +while read -r partition; do > >>>>> + # Here we rely on sfdisk-field.awk always putting size last. > >>>>> + : $((gptMiB +=3D ${partition##*=3D})) > >>>>> +done < >>>>> +$table > >>>>> +EOF > >>>> > >>>> Nit: should ${partition##*=3D} be in double quotes? > >>> > >>> I tried changing it, but it is apparently an "arithmetic syntax error" > >>> to use double quotes here. > >> > >> I'd use a separate variable then. > > > > Doesn't seem to make a difference. As an experiment: > > > > partition=3D"size=3D2 + 3" > > size=3D${partition##*=3D} > > printf "%s\n" $(($size)) > > > > This prints 5 even though a separate variable is used. It doesn't seem > > to be possible to get $(( =E2=80=A6 )) *not* to interpret arithmetic in > > variables. > > > > In bash, but not busybox ash as used in Nix builds, it is possible to > > use double quotes like you suggested, but $(("$size")) is /still/ 5. > > That's actually required by POSIX. What about: > > size=3D${partition##*=3D} > : $((gptMiB +=3D size)) How's that better? Arithmetic will still be expanded inside size =E2=80=94 or do you have some other concern with the parameter expansion inside the arithmetic expansion? --gcwyu4m2vtocukc7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQGoGac7QfI+H5ZtFCZddwkt31pFQUCaSoVjwAKCRCZddwkt31p FQS1AP9WFeh+GLyL5tAIvHAcR9ifL9xrc3GxsJJc59/PRzACWQEAhUp366sS/Qx0 EODJ7vMY7w7pp0ixC2IG2tUyDvDRzg8= =Fdf8 -----END PGP SIGNATURE----- --gcwyu4m2vtocukc7--