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 DDA826227; Sun, 21 Sep 2025 16:15:35 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 9E36061F5; Sun, 21 Sep 2025 16:15: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-b8-smtp.messagingengine.com (fout-b8-smtp.messagingengine.com [202.12.124.151]) by atuin.qyliss.net (Postfix) with ESMTPS id 0922561F4 for ; Sun, 21 Sep 2025 16:15:33 +0000 (UTC) Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id DC63D1D0006D; Sun, 21 Sep 2025 12:15:31 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Sun, 21 Sep 2025 12:15:31 -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=1758471331; x=1758557731; bh=qu7qSofVzD +Ris9ROw0+SF5nJkcX2E2qLkVW9iMeSqA=; b=jMZkCt8o+QB09rm5OdE9fDwBxx he9JEMbRep+h3Es8+Id+hRVA9skN9G7JuFnssn0n4C86ZeOB7vYH4YlnHII9os60 jq/Y+ZDanoQWTLRyA50yb6Xlmgcg2COZNh/EJenVgav065DQWLVNBQNxBVg8z6tg Di+edWLEOLilq1DnK0IcH1MaVu9EzKQoSSIS/X0tHrzZqHmR4l7Xi8DERWauW9mT aNq2T7i9vyFC27lvxRGr8PWECvYtwoSockPk6ItwsQBNcTPJhmx8YUeZQqqLQDc0 mhmpf7Kem/ZiTNPCzve0ZC5cpJjMFYd7ugDa4ObSxIzcD4ElR9+NqKm4JhUQ== 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= 1758471331; x=1758557731; bh=qu7qSofVzD+Ris9ROw0+SF5nJkcX2E2qLkV W9iMeSqA=; b=QQs+Bn4wb2kSBh+IMM0ljDrnZ9Eed0lYjEJ3j8TrwB3MXDnh6/R 5Hp1oXzAeXKAiC4Bj0+wRkB+Ht2jmd2gkY4YxTFub1DHNg+OCojuXcwky8c0nafP jV9vN1Nwl+L8B/TT0DBkRH0aLq3G76I36VHvfnmyyVv6arrxyL0FJUnUunT0ZGYS O7UJiiJgsuxizCKgNeVZeAr3z3pkV5L+9+1sateF5nGw+b0T6AxtGEuqZMmPF+sr NYVL9tmwUdqoEQjL3BII1i4aE1D3SQcvbnMD1qqYni67fWqwvLfI8X5wg622CIdk 6VoUkUQnSV2liQBZx/lwC+09B7R2Tx3Vy1A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdehheegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufgjfhffkfggtgesghdtreertddttdenucfhrhhomheptehlhihsshgrucft ohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepieduffeuie elgfetgfdttddtkeekheekgfehkedufeevteegfeeiffetvdetueevnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdrih hspdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegu vghmihhosggvnhhouhhrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepuggvvhgvlhessh hpvggtthhruhhmqdhoshdrohhrgh X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 21 Sep 2025 12:15:31 -0400 (EDT) Received: by mbp.qyliss.net (Postfix, from userid 1000) id 4B1C324BEAE8; Sun, 21 Sep 2025 18:15:30 +0200 (CEST) From: Alyssa Ross To: Demi Marie Obenour Subject: Re: [PATCH 1/3] scripts/make-erofs.sh: Avoid unneeded calls to awk and chmod In-Reply-To: References: <20250919-less-dirname-v1-0-5df7ca617b9b@gmail.com> <20250919-less-dirname-v1-1-5df7ca617b9b@gmail.com> <87v7lcdoub.fsf@alyssa.is> Date: Sun, 21 Sep 2025 18:15:29 +0200 Message-ID: <87plbj4w9q.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: 5TIYZOLXZ3SVBLV7NWVYNIJ4LXVRRO2B X-Message-ID-Hash: 5TIYZOLXZ3SVBLV7NWVYNIJ4LXVRRO2B 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/21/25 07:31, 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 >>> --- >>> Hyperfine confirms that this does improve performance, though there are >>> outliers. >>> --- >>> 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 b47048ad747bd7dfcc28e0f1dfd75ec090fa7e09..82d37573ad0454e79becfdd= d05f93585df7b671c 100755 >>> --- a/scripts/make-erofs.sh >>> +++ b/scripts/make-erofs.sh >>> @@ -30,18 +30,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 -- '{}' + >>> + continue >>> + fi >>=20 >> As I said last time, I don't love that this now only handles the case >> where / is given first, when previously the input didn't have to be in >> any particular order. >>=20 >> Maybe we could get the performance win /and/ preserve the unordered >> property of the input by reimplementing the logic from before in shell >> instead of awk, including testing whether any directories actually >> needed to be modified before invoking chmod using [ (probably a shell >> built-in)? > > That's always going to be true right now, though, and I can easily add > a check and bail out if it turns out to be false. I don't want extra > complexity. > > In the long term this needs to be rewritten in C or Python anyway. In my opinion, adding an ordering requirement when we can do fine without increases complexity, and rewriting what we currently have in shell doesn't. I can try that myself if you don't want to, and I'm also happy to take the following two patches without blocking them on this. (I would love an implementation of this that didn't require the copies at all, of course.) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaNAkoQAKCRBbRZGEIw/w oqgzAP9y6jzy7MFu0GXLlewEUhEAvOc2nSHiw0U1rDvvwzOm6AEAqVAy/RXv11L2 J0711fxkaaNZe00ziJVDxrhdcSZW3Ac= =lmPS -----END PGP SIGNATURE----- --=-=-=--