]> git.ipfire.org Git - thirdparty/git.git/commit
compat/fsmonitor: fix socket path in networked SHA256 repos
authorPatrick Steinhardt <ps@pks.im>
Fri, 14 Jun 2024 06:50:56 +0000 (08:50 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Jun 2024 17:26:34 +0000 (10:26 -0700)
commit2a0e11479f2e272236d56c38b5261944ef16fbbc
treecfc22ddbf3918994b8184ed8740132404108163f
parent99cf4d6d35c7e98dde958e75ff39cd01f2088506
compat/fsmonitor: fix socket path in networked SHA256 repos

The IPC socket used by the fsmonitor on Darwin is usually contained in
the Git repository itself. When the repository is hosted on a networked
filesystem though, we instead create the socket path in the user's home
directory or the socket directory. In that case, we derive the path by
hashing the repository path.

But while we always use SHA1 to hash the repository path, we then end up
using `hash_to_hex()` to append the computed hash to the socket path.
This is wrong because `hash_to_hex()` uses the hash algorithm configured
in `the_repository`, which may not be SHA1. The consequence is that we
may append uninitialized bytes to the path when operating in a SHA256
repository.

Fix this bug by using `hash_to_hex_algop()` with SHA1.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/fsmonitor/fsm-ipc-darwin.c