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 31FA11976C; Mon, 08 Sep 2025 08:33:33 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 8831C19739; Mon, 08 Sep 2025 08:33:29 +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-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) by atuin.qyliss.net (Postfix) with ESMTPS id 36D2F19737 for ; Mon, 08 Sep 2025 08:33:28 +0000 (UTC) Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id EC4E11D0010E; Mon, 8 Sep 2025 04:33:26 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Mon, 08 Sep 2025 04:33:27 -0400 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=1757320406; x=1757406806; bh=fvhTVNVQRB uMipoSf8RwW4iY57PNqvfhlh40PLMD+vw=; b=kJ5+U5ODlC9SI2jhr4zxJWbGoh 7Nii8G4fdFAPAzV/jJSle/KBsvYw/yuRJbbGxLElrLKrI+H0gwli7geUTvlg7V77 TCKVDZTmaWQ6AeFk+/uqKlQ1NnkPXnsHzTipubWPMCMipfQpmcjceIewZugWpjnx 4qC6Zqcbk4f1SxGWLoU4w/1Y7y7ZfM8bKppG4lrSSrDCT28o4dSXZ2RDRdIdmhrZ RvmWvftZXAbFlsLTRMl4iAtJQGmB9aib6Mzph7gDeaoZ0sf1tGJ8vsSu9sDMqoUb 9uoJ2GmgclV11y6J+4IX+CMidxVQZQGyFPQaJ6r3nA6MknUrLPzbHVL/kZNg== 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= 1757320406; x=1757406806; bh=fvhTVNVQRBuMipoSf8RwW4iY57PNqvfhlh4 0PLMD+vw=; b=Wy3vixCrPFlwikbo693qxSVFRHDGOccI9kgSrHSH6i0OGR+CDpU IWAr5kZo/WtS6bdhSG6zA8xj8PDnrQfbYoi9f88DX+qJ/pkOzf0WEa2X9QcYqQCS nHMQT2J7X/iwhh60WeCgNZyxNwVuDhuu7YOJu0p/Pe9T3BEb9uV0LdjPTqcrarJm hgI3/rugvE5Pzux0etj21cGckC2jMFR0mJRyAYBJTQrDpYQJMLqGymE3rM1aZbwl 3yXWpjormfsRLt39K4DuPGjMmhcK84qk1VITC71cfcQiOQdsQYDH1iIaEAXL/+ot BfQqwKWRyWoHs5fmHdKOoffjYXmGfa2RyEw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddujedthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufgjfhffkfggtgesghdtreertddttdenucfhrhhomheptehlhihsshgrucft ohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepieduffeuie elgfetgfdttddtkeekheekgfehkedufeevteegfeeiffetvdetueevnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdrih hspdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegu vghmihhosggvnhhouhhrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepuggvvhgvlhessh hpvggtthhruhhmqdhoshdrohhrgh X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 8 Sep 2025 04:33:26 -0400 (EDT) Received: by mbp.qyliss.net (Postfix, from userid 1000) id 2DA7C1674694; Mon, 08 Sep 2025 10:28:16 +0200 (CEST) From: Alyssa Ross To: Demi Marie Obenour Subject: Re: [PATCH 03/20] scripts/make-erofs.sh: Avoid unneeded calls to awk and chmod In-Reply-To: <20250904-systemd-v1-3-2a63b790a913@gmail.com> References: <20250904-systemd-v1-0-2a63b790a913@gmail.com> <20250904-systemd-v1-3-2a63b790a913@gmail.com> Date: Mon, 08 Sep 2025 10:28:15 +0200 Message-ID: <874itdl55s.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: YQJ4OQ2WBID7TEYXPY5THLMEW2UN6Y55 X-Message-ID-Hash: YQJ4OQ2WBID7TEYXPY5THLMEW2UN6Y55 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: Spectrum OS Development 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 Content-Transfer-Encoding: quoted-printable Demi Marie Obenour writes: > These calls were made to work around permission problems, but it is much > cleaner to solve these problems by making every directory in the new > filesystem image writable so that cp can write to it. > > Signed-off-by: Demi Marie Obenour > --- > scripts/make-erofs.sh | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh > index 3f211d848b938405510d0dbf6b11cf5512c9ef5d..e63bcbed9c3028f0f2b55431d= 46ba9ec67bc26ef 100755 > --- a/scripts/make-erofs.sh > +++ b/scripts/make-erofs.sh > @@ -37,18 +37,18 @@ while read -r arg1; do > fi > echo >=20=20 > - parent=3D"$(dirname "$arg2")" > - awk -v parent=3D"$parent" -v root=3D"$root" 'BEGIN { > - n =3D split(parent, components, "/") > - for (i =3D 1; i <=3D n; i++) { > - printf "%s/", root > - for (j =3D 1; j <=3D i; j++) > - printf "%s/", components[j] > - print > - } > - }' | xargs -rd '\n' chmod +w -- 2>/dev/null || : > - mkdir -p -- "$root/$parent" > + if [ "$arg2" =3D / ]; then > + cp -RT -- "$arg1" "$root" > + # Nix store paths are read-only, so fix up permissions > + # so that subsequent copies can write to directories > + # created by the above copy. This means giving all > + # directories 0755 permissions. > + find "$root" -type d -exec chmod 0755 -- '{}' + Won't this be much slower, since it runs across the whole root every time? We're going from one chmod() per path component to one for each directory in root, aren't we? > + continue > + fi >=20=20 > + parent=3D$(dirname "$arg2") > + mkdir -p -- "$root/$parent" > cp -RT -- "$arg1" "$root/$arg2" > done >=20=20 > > --=20 > 2.51.0 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaL6TnwAKCRBbRZGEIw/w otOBAPwLcpNLjwCxrawJR//KAdESlmhFgjv1VLvP422vL/IwwQD+OT40PfMydLLh HmqjG8+6M0BU2Psp9xwdzwaFZ8HGQAg= =ydEz -----END PGP SIGNATURE----- --=-=-=--