On 9/23/25 14:56, Alyssa Ross wrote:
Demi Marie Obenour <demiobenour@gmail.com> writes:
On 9/23/25 10:35, Alyssa Ross wrote:
Demi Marie Obenour <demiobenour@gmail.com> writes:
On 9/21/25 14:36, Alyssa Ross wrote:
Demi Marie Obenour <demiobenour@gmail.com> writes:
Don't call it if the target directory already exists.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> --- scripts/make-erofs.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh index ac62a65f53e0b6417b164f475a537960fc5203bc..30b83b0b41cbe7bc4fd7786cfcdddcf10c78cc5a 100755 --- a/scripts/make-erofs.sh +++ b/scripts/make-erofs.sh @@ -44,10 +44,15 @@ while read -r arg1; do # a subset of all paths, but this subset includes all of # the ones passed in practice other than /. case $arg2 in - (*/*) parent=${arg2%/*};; - (*) parent=.;; + (*/*) + # Make the parent directory if needed + parent=$root/${arg2%/*} + if [ ! -d "$parent" ]; then mkdir -p -- "$parent"; fi + ;; + (*) + # Parent $root which definitely exists + ;; esac - mkdir -p -- "$root/$parent" cp -RT -- "$arg1" "$root/$arg2" done
I saw a statistically significant speedup in hyperfine. :)
Reviewed-by: Alyssa Ross <hi@alyssa.is>
Yay! This is independent of the rest of the series, so feel free to commit.
It actually doesn't seem to be. I get a "Permission denied" build failure when I apply it on top of 0fcf508 ("scripts/make-erofs.sh: Avoid calls to dirname"), but I think I didn't see that failure when I applied patch 1 as well. We can either just keep this in the queue until we've figured out what to do about patch 1, or you can investigate and resubmit a standalone version of this patch. Up to you.
I think it is best to include patch 1. It speeds things up, and I consider the complexity to not be a serious problem. The code that generates the file lists already guarantees this. -- Sincerely, Demi Marie Obenour (she/her/hers)