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 7451D1C8F5; Mon, 24 Nov 2025 15:26:02 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 0C1AB1C8EA; Mon, 24 Nov 2025 15:25:59 +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 fhigh-b3-smtp.messagingengine.com (fhigh-b3-smtp.messagingengine.com [202.12.124.154]) by atuin.qyliss.net (Postfix) with ESMTPS id AAB601C963 for ; Mon, 24 Nov 2025 15:25:56 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9402A7A012A; Mon, 24 Nov 2025 10:25:53 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Mon, 24 Nov 2025 10:25:53 -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=fm2; t=1763997953; x=1764084353; bh=sybUo0rwOX +CMxe1ayNOY07gAFD3suCHou1O/0tJTN8=; b=OZXqZlJdsHop90ULtUg7leeLn1 MsG0hBx31YcDbwtDKHsxyqFfBSrM8pWl5/rVHVcenwcYBGx9HtQz4G8RG5lggUrZ rqdESVCI7gBGa2+Q0y9lthTq+3ngfUypoGcrraCVlGPnmEwMT693KpE5BF5IFhh4 SNdcxv+RhcmQa+CIJdA2u3AMab5gMKhIoeWabbN7hnOPJs/ZPqaGuK3qrhsl5kpW RsUw2e9l860J81T5f0nNP6fvJhYSGmVLu6GTd/JumOOwGHBmc77IGZkHqzCNnWTt //EYoyIx2bWXpf6AH8b7fz+bSXpb3qLMbG35rfYaOcnURSptfaSX9nq5abVA== 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=fm3; t= 1763997953; x=1764084353; bh=sybUo0rwOX+CMxe1ayNOY07gAFD3suCHou1 O/0tJTN8=; b=cigWNOP3nZoTK+Lcy85EUDHMndqR1vVfSO2s0zH334Fbp/PW63U f5ywUwc6VpGG1kxP8Y9PRgSx86LvfuktIf0tffG37lJDmZCWsFoPbFCfH/cQvJPI /YC8grF+EEhSQHRroirUiC8ae/rdka+PITiA1cNw+KimtZqfP51laTj/a40k3pO6 LWCccIRzRfvgsnuHU7ue55C/IWwX4hPyLyFXnUH4Dc+FD3zNCHO1cPANGh4hx5IV 5QuGrDXMTdoGbHLCzsfE2df+w7XnB/Q8l1mR2MynerN2HCo2Y9syvZowh0noYD4O uRiwnXzOESgIpSeVn/ZzGqz5iBiDB/Fxnbw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvfeekleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefujghffffkgggtsehgtderredttddtnecuhfhrohhmpeetlhihshhsrgcu tfhoshhsuceohhhisegrlhihshhsrgdrihhsqeenucggtffrrghtthgvrhhnpeeiudffue eilefgtefgtddttdekkeehkefgheekudefveetgeefiefftedvteeuveenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehhihesrghlhihsshgrrd hishdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohep uggvmhhiohgsvghnohhurhesghhmrghilhdrtghomhdprhgtphhtthhopeguvghvvghlse hsphgvtghtrhhumhdqohhsrdhorhhg X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 24 Nov 2025 10:25:52 -0500 (EST) Received: by fw12.qyliss.net (Postfix, from userid 1000) id C87642415543; Mon, 24 Nov 2025 16:25:36 +0100 (CET) From: Alyssa Ross To: Demi Marie Obenour Subject: Re: [PATCH 3/3] host/rootfs: add run-flatpak script In-Reply-To: <06f57b2f-97c7-42bf-97e1-a7abe4a5254d@gmail.com> References: <20251113120452.65711-1-hi@alyssa.is> <20251113120452.65711-3-hi@alyssa.is> <06f57b2f-97c7-42bf-97e1-a7abe4a5254d@gmail.com> Date: Mon, 24 Nov 2025 16:25:35 +0100 Message-ID: <87cy57311s.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: KG56AR6ATQNQOIN5LAQAKQVWWIF7FHGM X-Message-ID-Hash: KG56AR6ATQNQOIN5LAQAKQVWWIF7FHGM 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: --=-=-= Content-Type: text/plain Demi Marie Obenour writes: > On 11/13/25 07:04, Alyssa Ross wrote: >> +# SPDX-License-Identifier: EUPL-1.2+ >> +# SPDX-FileCopyrightText: 2024 Alyssa Ross >> + >> +backtick -E dir { mktemp -d /run/vm/by-id/XXXXXX } >> +backtick -E id { basename -- $dir } > > Serial substitution: if $1 or $2 contains something like ${dir} or ${id} > they will be expanded again. Can be avoided with multisubstitute: > > backtick dir { mktemp -d /run/vm/by-id/XXXXXX } > backtick id { importas -iS dir basename -- $dir } > multisubstitute { > import -iS dir > import -iS id > define install_dir $1 > define app_id $2 > } > > The general rule I follow is to never substitute a parameter into > an argv that has already been substituted into. This can be done > by renaming all "variables" whenever one does a substitution. > >> +if { mkdir -p /run/configs/${id}/fs } >> +if { redirfd -w 1 /run/configs/${id}/fs/type echo flatpak } >> +if { cd /run/configs/${id}/fs mount-flatpak $1 $2 } >> +if { >> + ln -s /usr/lib/spectrum/img/appvm/blk /usr/lib/spectrum/img/appvm/vmlinux >> + /run/configs/${id} >> +} >> + >> +if { ln -s /run/configs/${id} ${dir}/config } >> + >> +if { create-vm-dependencies $id } >> + >> +piperw 4 3 >> +background { >> + fdclose 3 >> + fdmove 0 4 >> + >> + # Wait for the VMM to be up, then start the VM. >> + if { redirfd -w 1 /dev/null head -1 } >> + vm-start $id >> +} >> +fdclose 4 >> + >> +foreground { run-vmm $id } >> +fdclose 3 >> + >> +if { >> + forx -pE service { >> + dbus >> + vhost-user-fs >> + vhost-user-gpu >> + xdg-desktop-portal-spectrum-host >> + } >> + s6-instance-delete /run/service/${service} $id >> +} > > Serial substitution again. This should not be an issue: POSIX requires > mktemp to use only characters in the portable filename character set, > and $ is not in that set. An execline static analyzer would flag > this, though. > > If you want to avoid serial substitution, the usual workaround of > multisubstitute should do the job. > Minor correction: POSIX doesn't specify mktemp(1), only the library functions, but Busybox mktemp uses mkdtemp(3), which is also specified to use the portable character set. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQQGoGac7QfI+H5ZtFCZddwkt31pFQUCaSR47wAKCRCZddwkt31p Fa64AQDvZQtnMnokHIq9N9VN2U5HZQrn3xelQGcHyJJ55SEoGAEAoUUaMRFgexPI B1cPdNZvRCcqj5x0VNGOKYbBS4HjUAM= =qkAR -----END PGP SIGNATURE----- --=-=-=--