Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: git@vger.kernel.org
Subject: Re: [BUG] 'ls-files path' fails if absolute path of workdir contains NFD (macOS)
Date: Wed, 1 May 2024 00:52:38 +0900	[thread overview]
Message-ID: <44EB4C2D-5C86-4448-B8D8-3E90F75DB5CB@kba.biglobe.ne.jp> (raw)
In-Reply-To: <20240430071247.GB1504@tb-raspi4>


> 2024/04/30 16:12, Torsten Bögershausen <tboegi@web.de> 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)


  reply	other threads:[~2024-04-30 15:52 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 [this message]
2024-04-30 16:58     ` Torsten Bögershausen

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=44EB4C2D-5C86-4448-B8D8-3E90F75DB5CB@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=git@vger.kernel.org \
    --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 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).