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 9FD5C231FC; Fri, 19 Sep 2025 23:28:17 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 1EC7023255; Fri, 19 Sep 2025 23:28:13 +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.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_PASS,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) by atuin.qyliss.net (Postfix) with ESMTPS id 1605523251 for ; Fri, 19 Sep 2025 23:28:12 +0000 (UTC) Received: by mail-yb1-xb31.google.com with SMTP id 3f1490d57ef6-eabe0d02398so981450276.0 for ; Fri, 19 Sep 2025 16:28:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758324491; x=1758929291; darn=spectrum-os.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XTP9dij/xW/2eblzDLNxBKGXN53rvlaGsqleJhaxXsw=; b=KEKipq2pyC3B/JQ8s8US/Q5xmmcDCNb2pIfvoSkbtdWgbqeg617TrN0aSxvnSNaro2 Dv5bXN0HRRORwVuhXL59RFNl+SNas8Wx87oDdyR6/ggxg7jTJDU/WeU3amv4H5u41t4H Z0z/2Eq98quT8iFIXS3IVE/LiDp7+k70adDWoqaR4rmwusV5vToaYbcaeyrfalkQqKo0 s6irAk+swy0HtqBSIME1KX9Xxcf3ZHJRn7y/8e6vULxIeiscPJsAE6pXaFZt5p449p+m D1kz71wsLUdFfeCZBThCgKA7kno+opyWAzriSEZI2HFhSTZr5XKnwts62VEVS0yDVOXC +ejg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758324491; x=1758929291; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XTP9dij/xW/2eblzDLNxBKGXN53rvlaGsqleJhaxXsw=; b=EfFxxpJl9R/uk/OHt812Stfuhl5R6/OHTnFz2uWB6JiIV9Tn4LiXYjuzPnsCiEKYVe JCgIofROTzVMXS3wikTh4VV0THR5Ygw70BxbTnPfzrCOC+I0USCsxJVKMNF7HEWQxOuj JhQSXjEyBCXD8HYcSL2INeMvQmddf6mcYCB3mQeUSNI4766V6RbLd+qn3ShXNOE/X3sV DZHXTMAKbLO1vcXg17G3wEMLqsN+J9sot+Svpl29k+A/F8MxaD8i6FmGKL9NroVq+LsW z32WyEAtfZcfw9ANxmecN/lYMldJxtZ37gBODwVJRCtZrHe/jaKpyjXlzxD7Ww90ox7n TOiA== X-Gm-Message-State: AOJu0Yw66PvDs2WwbkshryBJKv/qGeWQWnyg4zT21DU8u1iYaYHc+UAR oDoDaq2J0b8fY4LWL4cJJgRQomaK9Q23JaGaJklEvAQoYMH90saVSBmK5n/eig== X-Gm-Gg: ASbGncuJSc7QOSDxm9awTV/7YBOrj2mMyn3h4YwYQ0J6gtlD5HWywcD5fD0LiZj2KC1 ijl1byLXEgHavEk8gt931UV7a1r5+YfA/UGlXgjMmJjsxCv5pD//AEZriGpyymQoW6sexu3OEa4 S5nBGGhcjEy13iuj507eK41Y8ScnEFyDc6ziaHpKVv4EdmX1NbqvdAai471gUwYw2vh2+Ml3lk1 eEzVGtvW9v6KZexFGNH9zZ/ay/RGUgBz/9r60baUJ5MuEI2MrLM3XQziqpXsBjVOdXbgW7c2STZ d6TqqKCUzx+/E4/r3RWFmy7QIyQVZ2FyA7fnGEU+nU6rqp9yGUj48Fgq+LeMhIdeVfIM/GG9Nj3 h6UQug2JZE/piYJvUP/MxWGBe1X5WSgEcTe42EI0VYaiPwGsMU59Z+kudHzVTsPQs8Ft5LJvn3f VeUQAt6tHPBGRDPTD7KnNMi73C18S7Wv6rRpsjlIftsAg= X-Google-Smtp-Source: AGHT+IFlulH/EdpTVoXYCDxQtKMCPiX5FXy36IVYAGhCZKMy2oDNMVYH8eGIDOzaof5RD/A6cKCRhw== X-Received: by 2002:a05:6902:490e:b0:ea5:d57a:c920 with SMTP id 3f1490d57ef6-ea862876ea4mr5512569276.3.1758324490695; Fri, 19 Sep 2025 16:28:10 -0700 (PDT) Received: from localhost.localdomain (h96-60-249-169.cncrtn.broadband.dynamic.tds.net. [96.60.249.169]) by smtp.gmail.com with UTF8SMTPSA id 3f1490d57ef6-ea5ce854219sm2068122276.16.2025.09.19.16.28.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Sep 2025 16:28:09 -0700 (PDT) From: Demi Marie Obenour Date: Fri, 19 Sep 2025 19:26:11 -0400 Subject: [PATCH 1/3] scripts/make-erofs.sh: Avoid unneeded calls to awk and chmod MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250919-less-dirname-v1-1-5df7ca617b9b@gmail.com> References: <20250919-less-dirname-v1-0-5df7ca617b9b@gmail.com> In-Reply-To: <20250919-less-dirname-v1-0-5df7ca617b9b@gmail.com> To: Spectrum OS Development X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758324370; l=1537; i=demiobenour@gmail.com; s=20250729; h=from:subject:message-id; bh=MIScOLv6VEDM5K16RGzA6PFgMaES+lUTUy/o9eMldkw=; b=DoM/z+NJ8fbAUE6KMQk9ZWNn/V2QPEjY1yJSorFyjhHInyoYOkEISXcbHkc1PiCUnjOZOHcyc +K3aRujxTdvB0areMSQOs/vhnFq64HJ8ktwZb6syNUSkchvdwSC7rlu X-Developer-Key: i=demiobenour@gmail.com; a=ed25519; pk=X57Q4/YQDj9t4SBeKaDwvXYKB6quZJVx/DE2Ly2out0= Message-ID-Hash: BSZC7CC5QZF4MSGXTPADHIT2AMOOY6XX X-Message-ID-Hash: BSZC7CC5QZF4MSGXTPADHIT2AMOOY6XX X-MailFrom: demiobenour@gmail.com 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: Demi Marie Obenour , Alyssa Ross 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: 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..82d37573ad0454e79becfddd05f93585df7b671c 100755 --- a/scripts/make-erofs.sh +++ b/scripts/make-erofs.sh @@ -30,18 +30,18 @@ while read -r arg1; do fi echo - parent="$(dirname "$arg2")" - awk -v parent="$parent" -v root="$root" 'BEGIN { - n = split(parent, components, "/") - for (i = 1; i <= n; i++) { - printf "%s/", root - for (j = 1; j <= i; j++) - printf "%s/", components[j] - print - } - }' | xargs -rd '\n' chmod +w -- 2>/dev/null || : - mkdir -p -- "$root/$parent" + if [ "$arg2" = / ]; 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 + parent=$(dirname "$arg2") + mkdir -p -- "$root/$parent" cp -RT -- "$arg1" "$root/$arg2" done -- 2.51.0