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 7500E4C4E; Sun, 21 Sep 2025 11:31:32 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 733434C48; Sun, 21 Sep 2025 11:31: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 fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) by atuin.qyliss.net (Postfix) with ESMTPS id BEC644C44 for ; Sun, 21 Sep 2025 11:31:27 +0000 (UTC) Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id 8251A1400089; Sun, 21 Sep 2025 07:31:26 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Sun, 21 Sep 2025 07:31:26 -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=1758454286; x=1758540686; bh=Us6P22UfCF 5PQTuu1d7rrlc17zH1d1ByLx+++nulpk8=; b=CU8zNt4eCImTEQGgZT5dpBbwGB ihroi64c3tY1OgQmi+BE3EEGTFAfNiwMV0n+x/XDD7qZiO0y+hsFn549RYv/9tKZ xn/LlWdSQt6V3OZwe8Imxz1MQzo31BAHKanQnQFWSjy7CBP7ouwxQFFb+04pqgD/ DtSHAGlvZzl2B7eq/tycMN/49Emc1c7aB7rbro+zL4M2sUHwa2apCRXDEdk0ygJI 17InoLP51q8YzQsDREa4GXeq9oKYr3XgfYZxmrq0Pgecy/dkvi6BuxIFH/As0Xnn RrqNfXFw8s8hJEAm3kUDOmXeUcpftxAPLSCyGkX9a/bO8zuaY1QNPGAeBmhQ== 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= 1758454286; x=1758540686; bh=Us6P22UfCF5PQTuu1d7rrlc17zH1d1ByLx+ ++nulpk8=; b=HpuWlEgmGk9RlltHdhl4ZZf5oWDBw//72vTWzoYkeCrGRmC3lGE kQFBkpyTGI6UBVX5pfckjw5AfOCdT0u7QcnKDo1UpGwacaCByvl3RCrMChIpVAdq cdwkZZCAc4tAyIjYZua8nl+LyN3ru06uTcqrdcSSD1yqiDNVa81tmwBchGAiF5I2 zlI/twUSysTHrVr72hSKumjebgj7UgdFHNlR/WH4WTyhkknNewRrMw69WqdZgXX/ JZyv8NPAkFIlId9PWnlbSWRe72an2kPIJCExGorc3hNxKWLzRyxxW7Iu/utwM9PC AchEfVpcnKaa5+S8BvVASPPxbq+Lvbuwtkg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdehgeekiecutefuodetggdotefrod 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 07:31:25 -0400 (EDT) Received: by mbp.qyliss.net (Postfix, from userid 1000) id 8F1CF20047F4; Sun, 21 Sep 2025 13:31:09 +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: <20250919-less-dirname-v1-1-5df7ca617b9b@gmail.com> References: <20250919-less-dirname-v1-0-5df7ca617b9b@gmail.com> <20250919-less-dirname-v1-1-5df7ca617b9b@gmail.com> Date: Sun, 21 Sep 2025 13:31:08 +0200 Message-ID: <87v7lcdoub.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: RHWDQ4C5NTE5MT6MPESZRPUXOIPB76OA X-Message-ID-Hash: RHWDQ4C5NTE5MT6MPESZRPUXOIPB76OA 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 > --- > 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..82d37573ad0454e79becfddd0= 5f93585df7b671c 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 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. 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)? >=20=20 > + parent=3D$(dirname "$arg2") > + mkdir -p -- "$root/$parent" > cp -RT -- "$arg1" "$root/$arg2" > done --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaM/h/AAKCRBbRZGEIw/w or5GAQC1Vp7yA+qTFuweJoQVQ2Xh/wqq2DG32IAAdv1eaQ1coQEAxneiMxeqhwR2 fDfjODXNmxHpUpdE7ZZdslzzFq7swQo= =ArQu -----END PGP SIGNATURE----- --=-=-=--