git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/3] credential-cache--daemon: do not apply core.sharedRepository

From
Farid Zakaria <farid.m.zakaria@gmail.com>
Date
Nov 4, 2026, 19:53 UTC
Message-ID
<20261104-fz-credential-cache-race-v2-1-ddccd0831eba@gmail.com>
In-Reply-To
<20261104-fz-credential-cache-race-v2-0-ddccd0831eba@gmail.com>

init_socket_directory() creates the leading directories of the socket path with safe_create_leading_directories_const(). That function honors "core.sharedRepository", which is meant for files inside the git directory. The socket lives in the user's home directory, e.g. "~/.cache/git/credential", and the repository the daemon happens to be started from has no say over its permissions.

Use safe_create_leading_directories_no_share_const() instead, which ignores "core.sharedRepository".

Signed-off-by: Farid Zakaria <farid.m.zakaria@gmail.com>
---
 builtin/credential-cache--daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c
index 65cc619bec..5cc39cd172 100644
--- a/builtin/credential-cache--daemon.c
+++ b/builtin/credential-cache--daemon.c
@@ -271,7 +271,7 @@ static void init_socket_directory(const char *path)
 		 * condition in which somebody can chdir to it, sleep, then try to open
 		 * our protected socket.
 		 */
-		if (safe_create_leading_directories_const(the_repository, dir) < 0)
+		if (safe_create_leading_directories_no_share_const(dir) < 0)
 			die_errno("unable to create directories for '%s'", dir);
 		if (mkdir(dir, 0700) < 0)
 			die_errno("unable to mkdir '%s'", dir);
-- 
2.55.0
Previous: Farid ZakariaNext: Farid Zakaria
Message 12 of 14 in “credential-cache: fix two races when daemons start at once”
  1. 0/2 credential-cache: fix two races when daemons start at onceFarid Zakaria, Nov 1, 2026
  2. 1/2 credential-cache--daemon: allow a concurrently created socket dirFarid Zakaria, Nov 1, 2026
  3. Patrick SteinhardtNov 3, 2026
  4. Farid ZakariaNov 4, 2026
  5. Jeff KingNov 4, 2026
  6. 2/2 credential-cache--daemon: do not take over a running daemon's socketFarid Zakaria, Nov 1, 2026
  7. Patrick SteinhardtNov 3, 2026
  8. Farid ZakariaNov 4, 2026
  9. Junio C HamanoNov 3, 2026
  10. Jeff KingNov 4, 2026
  11. 0/3 credential-cache: fix two races when daemons start at onceFarid Zakaria, Nov 4, 2026
  12. 1/3 credential-cache--daemon: do not apply core.sharedRepositoryFarid Zakaria, Nov 4, 2026
  13. 2/3 credential-cache--daemon: allow a concurrently created socket dirFarid Zakaria, Nov 4, 2026
  14. 3/3 credential-cache--daemon: do not take over a running daemon's socketFarid Zakaria, Nov 4, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.