Re: [PATCH 2/2] scripts/make-erofs.sh: run mkdir less

Demi Marie Obenour
2025-09-30T16:01:26Z

[-- Attachment #1.1.1: Type: text/plain, Size: 855 bytes --]

On 9/30/25 05:19, Alyssa Ross wrote:
> [ is likely a shell builtin, so by checking for existence before
> running mkdir, we avoid lots of mkdir spawns.
>
> Signed-off-by: Alyssa Ross <hi@alyssa.is>
> ---
> scripts/make-erofs.sh | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh
> index 551ae4a..ad04844 100755
> --- a/scripts/make-erofs.sh
> +++ b/scripts/make-erofs.sh
> @@ -61,7 +61,9 @@ while read -r arg1; do
> )
>
> # shellcheck disable=SC2031 # shadowed in subshell on purpose
> - mkdir -p -- "$root/$parent"
> + if ! [ -e "$root/$parent" ]; then
> + mkdir -p -- "$root/$parent"
> + fi
>
> cp -RT -- "$arg1" "$root/$arg2"
> done

Reviewed-by: Demi Marie Obenour <demiobenour@gmail.com>
--
Sincerely,
Demi Marie Obenour (she/her/hers)

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]