All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: tboegi@web.de
Cc: git@vger.kernel.org,  takimoto-j@kba.biglobe.ne.jp
Subject: Re: [PATCH v1 1/2] t0050: ls-files path fails if path of workdir is NFD
Date: Tue, 07 May 2024 10:30:16 -0700	[thread overview]
Message-ID: <xmqq1q6dpm1j.fsf@gitster.g> (raw)
In-Reply-To: <20240507084429.19781-1-tboegi@web.de> (tboegi@web.de's message of "Tue, 7 May 2024 10:44:29 +0200")

tboegi@web.de writes:

> From: Torsten Bögershausen <tboegi@web.de>
>
> Add a test case for this bug report, slightly edited and shortened:
>
> ls-files path' fails if absolute path of workdir contains NFD (macOS)
> On macOS, 'git ls-files path' does not work (gives an error)
> if the absolute 'path' contains characters in NFD (decomposed).
> I guess this is a (minor) bug of git.
>
> $ cd /somewhere         # some safe place, /tmp or ~/tmp etc.
> $ mkdir $'u\xcc\x88'    # ü in NFD
> $ cd ü                  # or cd $'u\xcc\x88' or cd $'\xc3\xbc'
> $ git init
> $ git ls-files $'/somewhere/u\xcc\x88'   # NFD
>   fatal: /somewhere/ü: '/somewhere/ü' is outside repository at '/somewhere/ü'
> $ git ls-files $'/somewhere/\xc3\xbc'    # NFC
> (the same error as above)
>
> In the 'fatal:' error message, there are three ü;
> the 1st and 2nd are in NFC, the 3rd is in NFD.
>
> The added test case here follows the error description,
> with the exception that the 'ü' is replaced by an 'ä',
> which we already have as NFD and NFC in t0050.
> A fix will be done in the next commit.

That will break bisection.  I think combining the two commits into
one would make sense for a small change like this, consisting a
focused and straight-forward fix plus a clean and concise test.

> Reported-by: Jun T <takimoto-j@kba.biglobe.ne.jp>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---
>  t/t0050-filesystem.sh | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
> index 325eb1c3cd..bb85ec38cb 100755
> --- a/t/t0050-filesystem.sh
> +++ b/t/t0050-filesystem.sh
> @@ -156,4 +156,16 @@ test_expect_success CASE_INSENSITIVE_FS 'checkout with no pathspec and a case in
>  	)
>  '
>
> +test_expect_success 'git ls-files under NFD' '
> +	(
> +		mkdir somewhere &&
> +		mkdir somewhere/$aumlcdiar &&

Would a single "mkdir -p" suffice?

		mkdir -p "somewhere/$aumlcdiar" &&

> +		mypwd=$PWD &&
> +		cd somewhere/$aumlcdiar &&
> +		git init &&
> +		git ls-files "$mypwd/somewhere/$aumlcdiar"  2>err &&

We do not control what is in "$mypwd".  Can it have funny characters
that can confuse Git?  Quoting the path with a pair of double quotes
protects the shell from getting confused with $IFS whitespaces, but
we may want to protect the pathspec handing in Git with something
like

	git --literal-pathspecs ls-files "..." 

here.

> +		>expected &&
> +		test_cmp expected err
> +	)
> +'
>  test_done
> --
> 2.41.0.394.ge43f4fd0bd

  reply	other threads:[~2024-05-07 17:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240430032717281.IXLP.121462.mail.biglobe.ne.jp@biglobe.ne.jp>
2024-05-07  8:44 ` [PATCH v1 1/2] t0050: ls-files path fails if path of workdir is NFD tboegi
2024-05-07 17:30   ` Junio C Hamano [this message]
2024-05-07  8:44 ` [PATCH v1 2/2] strbuf_getcwd() needs precompse_strbuf_if_needed() tboegi
2024-05-07 17:22   ` Junio C Hamano
2024-05-09 15:24     ` Junio C Hamano
2024-05-09 15:29       ` Torsten Bögershausen
2024-05-07 17:47   ` Junio C Hamano
2024-05-08  0:32     ` brian m. carlson
2024-05-09 16:11 ` [PATCH v2 1/1] macOS: ls-files path fails if path of workdir is NFD tboegi
2024-05-09 16:37   ` Junio C Hamano
2024-05-19  7:03   ` Jun. T
2024-05-20 16:06     ` Torsten Bögershausen
2024-05-20 18:08       ` Junio C Hamano
2024-05-20 19:21         ` Torsten Bögershausen
2024-05-21 14:14 ` [PATCH v3 " tboegi
2024-05-21 17:50   ` Junio C Hamano
2024-05-21 20:57     ` Torsten Bögershausen
2024-05-21 22:15       ` Junio C Hamano
2024-05-23 15:33         ` Jun. T
2024-05-25 20:01           ` Torsten Bögershausen
2024-05-31 19:31 ` [PATCH v4 " tboegi
2024-06-01 15:55   ` Junio C Hamano
2024-06-02 19:40     ` Torsten Bögershausen
2024-06-04  0:56   ` Jun T

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=xmqq1q6dpm1j.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=takimoto-j@kba.biglobe.ne.jp \
    --cc=tboegi@web.de \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.