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 CA0869B63; Wed, 10 Sep 2025 18:45:43 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 519529B50; Wed, 10 Sep 2025 18:45:41 +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-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) by atuin.qyliss.net (Postfix) with ESMTPS id 674309B4B for ; Wed, 10 Sep 2025 18:45:39 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id E728F140036D; Wed, 10 Sep 2025 14:45:37 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 10 Sep 2025 14:45:37 -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=1757529937; x=1757616337; bh=R3Xw0dIWI2 tqhIGwkw/RFEe7h6VFPUfK9Lnvwfj/mU4=; b=P7dYveazmCcMtlT0wp4H8gQVi9 XcHYvXKhQpjWrRK+vGfCnswZk81XK2dhuc/x1igVipPsVvX1nJYC/k7WgQB/pbRC 3FIPXTGXEokxAsQwBiQeir1HrADhCJD6JoD1TQL4EmMdVESXopuj3JBOXzj75D/H xyRUVcdvY9tV26nvObuqNVPszuxkjKSW+HxvmdkwIyfhSe73/Df5aHayQGUbqIfw LxQjZkf3/e7n8wXMgUlF8LAN2l6pOJeHqTfGN2Db7LfQn2+o14GEMa3RrcP7y/aw YPB4amF8RTznHHRvk/x3LXjOru+PIHWFb3AHYRid1QFJHtf4jQdwSVFnZccA== 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= 1757529937; x=1757616337; bh=R3Xw0dIWI2tqhIGwkw/RFEe7h6VFPUfK9Ln vwfj/mU4=; b=AYoGswfgq4SUqzW3oPjZOR/STnmZqARV03rVBpL7srWhhE3JpJ5 J4GVGod4PORcQGezrEV8TxxS8rauGOm3xygr15lw4F1J1TD0j6gEKDmiI4sxtgme 7/lvPmgzbHhi49+sONm6wu+kJw5YRJKnZ0c035qXFO3PeaFJlcSjHBmy1Mxc+TlT nTw4t6xeasUhng+UwNk51KlR0vXze3aebNx1C6UfAA6sLClogFmAkCcCvDBvE9wm DCW2LkjbQi927YymGeel3FoiTLGAQd63Un/TSsXAQ0lJoxttoZD2E7gPP8I4hXBG hIolTsdZ0Ya6GOBa2gYkrW7Jd1gf4bw7rkQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvgedtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufgjfhffkfggtgesghdtreertddttdenucfhrhhomheptehlhihsshgrucft ohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepieduffeuie elgfetgfdttddtkeekheekgfehkedufeevteegfeeiffetvdetueevnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdrih hspdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegu vghmihhosggvnhhouhhrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepuggvvhgvlhessh hpvggtthhruhhmqdhoshdrohhrgh X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Sep 2025 14:45:37 -0400 (EDT) Received: by mbp.qyliss.net (Postfix, from userid 1000) id D9A3916F2047; Wed, 10 Sep 2025 20:45:29 +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: <3d4137fe-dcdc-44ff-b74c-ad3d0a2b90b0@gmail.com> References: <20250904-systemd-v1-0-2a63b790a913@gmail.com> <20250904-systemd-v1-3-2a63b790a913@gmail.com> <874itdl55s.fsf@alyssa.is> <3d4137fe-dcdc-44ff-b74c-ad3d0a2b90b0@gmail.com> Date: Wed, 10 Sep 2025 20:45:28 +0200 Message-ID: <87y0qm87uf.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: VDU672EXU42HAUB74IOTZGCVSJO4WXRD X-Message-ID-Hash: VDU672EXU42HAUB74IOTZGCVSJO4WXRD 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: > On 9/8/25 04:28, Alyssa Ross wrote: >> Demi Marie Obenour writes: >>=20 >>> 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..e63bcbed9c3028f0f2b5543= 1d46ba9ec67bc26ef 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 -- '{}' + >>=20 >> 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? > > The root directory is always the first one populated. Most of the > root filesystem is the Nix store, which this skips. The call to find > operates on only the stuff *not* in the Nix store. Also, there are > significantly fewer calls to fork() and execve(). chmod is called with > many arguments at once by find. I suppose it is. I think when writing make-erofs.sh, my intention was to have order not matter, though, and if a directory in my Spectrum source tree is somehow read-only, I'd want that chmod-ed too. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaMHHSQAKCRBbRZGEIw/w ounDAQCq4bgHmYaINHzbbo42mFGfWcPYaoVNCidBXpZspiC8xQEA6dWMiaqKnBni YUZL0X/PLrocZ7k6xg8tg8hEqxdDHg8= =p9fn -----END PGP SIGNATURE----- --=-=-=--