Re: [BUG] 'ls-files path' fails if absolute path of workdir contains NFD (macOS)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux