Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <>
To: "Jun. T" <>
Subject: Re: [BUG] 'ls-files path' fails if absolute path of workdir contains NFD (macOS)
Date: Tue, 30 Apr 2024 18:58:31 +0200	[thread overview]
Message-ID: <20240430165831.GA3546@tb-raspi4> (raw)
In-Reply-To: <>

On Wed, May 01, 2024 at 12:52:38AM +0900, Jun. T wrote:
> > 2024/04/30 16:12, Torsten Bögershausen <> wrote:
> >
> > I am familar with the NFC/NFD stuff, but not with get_git_work_tree(),
> > at least not yet.
> >
> > If you have a suggestion for a patch, would you like to share it ?
> Well, the only thing I can tell is the patch below _seems_ to fix
> the _current_ problem. There may be other problems, it may introduce
> new problem(s) (such as memory leak), etc.
> But I don't know anything about the git internals and have no time
> now to investigate further. Sorry.
> get_git_work_tree() just returns the value of the_repository->worktree
> but I have no idea where this variable is set.
> get_git_work_tree() and the_repository->worktree are used in
> many places, and I'm not sure changing the function/variable has
> no bad side effects or not.
> And how to convert into NFC? By precompose_string_if_needed()?
> Does this function allocate a new memory for NFC? If so, do we
> need to free it at some point?
> diff --git a/setup.c b/setup.c
> index f4b32f76e3..3f2f3ed016 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -47,7 +47,7 @@ static int abspath_part_inside_repo(char *path)
>  	size_t wtlen;
>  	char *path0;
>  	int off;
> -	const char *work_tree = get_git_work_tree();
> +	const char *work_tree = precompose_string_if_needed(get_git_work_tree());
>  	struct strbuf realpath = STRBUF_INIT;
>  	if (!work_tree)

Thanks for digging - I have spend some time to find the cause,
but no success yet.
There is even a set_git_work_tree() in environment.c, and that may
need some treatment - or some other place.
To be continued - I will continue digging, where the NFD comes into Git.

      reply	other threads:[~2024-04-30 16:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30  3:27 [BUG] 'ls-files path' fails if absolute path of workdir contains NFD (macOS) Jun T
2024-04-30  7:12 ` Torsten Bögershausen
2024-04-30 15:52   ` Jun. T
2024-04-30 16:58     ` Torsten Bögershausen [this message]

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:

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

  git send-email \
    --in-reply-to=20240430165831.GA3546@tb-raspi4 \ \ \ \

* 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 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 read-only IMAP folder(s) and NNTP newsgroup(s).