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

Re: Is there a reason the credential cache server cowardly refuses to delete/reuse the socket file?

From
Jeff King <peff@peff.net>
Date
Jun 17, 2014, 09:45 UTC
Message-ID
<20140617094516.GB6267@sigill.intra.peff.net>
In-Reply-To
<7EDCFBB4F08F4A0EBB5D19A481BF7D5A@black>
On Sun, Jun 15, 2014 at 10:52:09AM -0400, Jason Pyeron wrote:
Show 8 quoted lines
> > Could this be a cygwin weirdness? I'd be interested to see the output
> > of:
> > 
> >   echo url=https://example.com |
> 
> >   strace -f git credential-cache get
> 
> On cygwin things can git a bit weird, I changed it to the actual executable.

Ugh, I forgot how difficult cygwin strace is to read. I think the interesting bit is here:

Show 7 quoted lines
> 1053395 1084132 [main] git-credential-cache 4308 __set_errno: void
> __set_winsock_errno(const char*, int):230 setting errno 0
>    88 1084220 [main] git-credential-cache 4308 __set_winsock_errno: connect:1118
> - winsock error 0 -> errno 0
>    46 1084266 [main] git-credential-cache 4308 getpid: 4308 = getpid()
>    37 1084303 [main] git-credential-cache 4308 cygwin_connect: -1 = connect(3,
> 0x22A5A2, 110), errno 0

So yeah, it looks like errno does not get set properly in this case. I think the only thing to do is just loosen the error path, like:

diff --git a/credential-cache.c b/credential-cache.c
index 9a03792..d0a1106 100644
--- a/credential-cache.c
+++ b/credential-cache.c
@@ -72,8 +72,6 @@ static void do_cache(const char *socket, const char *action, int timeout,
 	}
 
 	if (send_request(socket, &buf) < 0) {
-		if (errno != ENOENT && errno != ECONNREFUSED)
-			die_errno("unable to connect to cache daemon");
 		if (flags & FLAG_SPAWN) {
 			spawn_daemon(socket);
 			if (send_request(socket, &buf) < 0)

I'd rather not do that on all platforms, though (I guess we could also
check explicitly for "errno == 0", but I have a feeling that many errors
may return errno==0 on your platform).

Can you confirm that works? I suppose we can wrap it in an #ifdef.

-Peff
Previous: Jason Pyeron
Message 5 of 5 in “Is there a reason the credential cache server cowardly refuses to delete/reuse the socket file?”
  1. Jason PyeronJun 15, 2014
  2. Jeff KingJun 15, 2014
  3. Jason PyeronJun 15, 2014
  4. Jason PyeronJun 15, 2014
  5. Jeff KingJun 17, 2014

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.