patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Demi Marie Obenour <demiobenour@gmail.com>
Cc: Spectrum OS Development <devel@spectrum-os.org>
Subject: Re: [PATCH 2/3] scripts/make-erofs.sh: Avoid calls to dirname
Date: Sun, 21 Sep 2025 13:40:28 +0200	[thread overview]
Message-ID: <87seggdoer.fsf@alyssa.is> (raw)
In-Reply-To: <20250919-less-dirname-v1-2-5df7ca617b9b@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1020 bytes --]

Demi Marie Obenour <demiobenour@gmail.com> writes:

> Use builtin string manipulation instead.
>
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>

With a copyright header added:

Reviewed-by: Alyssa Ross <hi@alyssa.is>

> ---
>  scripts/make-erofs.sh | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh
> index 82d37573ad0454e79becfddd05f93585df7b671c..ac62a65f53e0b6417b164f475a537960fc5203bc 100755
> --- a/scripts/make-erofs.sh
> +++ b/scripts/make-erofs.sh
> @@ -40,7 +40,13 @@ while read -r arg1; do
>  		continue
>  	fi
>  
> -	parent=$(dirname "$arg2")
> +	# The below simple version of dirname(1) can only handle
> +	# a subset of all paths, but this subset includes all of
> +	# the ones passed in practice other than /.
> +	case $arg2 in
> +	(*/*) parent=${arg2%/*};;
> +	(*) parent=.;;
> +	esac
>  	mkdir -p -- "$root/$parent"
>  	cp -RT -- "$arg1" "$root/$arg2"
>  done
>
> -- 
> 2.51.0

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2025-09-21 11:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 23:26 [PATCH 0/3] Optimize scripts/make-erofs.sh Demi Marie Obenour
2025-09-19 23:26 ` [PATCH 1/3] scripts/make-erofs.sh: Avoid unneeded calls to awk and chmod Demi Marie Obenour
2025-09-21 11:31   ` Alyssa Ross
2025-09-21 15:56     ` Demi Marie Obenour
2025-09-21 16:15       ` Alyssa Ross
2025-09-21 17:12         ` Demi Marie Obenour
2025-09-21 18:06         ` Demi Marie Obenour
2025-09-19 23:26 ` [PATCH 2/3] scripts/make-erofs.sh: Avoid calls to dirname Demi Marie Obenour
2025-09-21 11:40   ` Alyssa Ross [this message]
2025-09-23 18:54   ` Alyssa Ross
2025-09-19 23:26 ` [PATCH 3/3] scripts/make-erofs.sh: Avoid unneeded calls to mkdir Demi Marie Obenour
2025-09-21 18:36   ` Alyssa Ross
2025-09-21 18:37     ` Demi Marie Obenour
2025-09-23 14:35       ` Alyssa Ross
2025-09-23 18:06         ` Demi Marie Obenour
2025-09-23 18:56           ` Alyssa Ross
2025-09-23 21:41             ` Demi Marie Obenour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87seggdoer.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --cc=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).