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

2014-06-17 Thread Jeff King
On Sun, Jun 15, 2014 at 10:52:09AM -0400, Jason Pyeron wrote:

  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:

 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
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-06-15 Thread Jason Pyeron
Whenever my computer crashes, I am left with a socket file. On next git
invocation it tries to conenct to the file, but the daemon is not running so it
barfs until I delete the file.

jpyeron@black /projects/dcarr/saar
$ git push
fatal: unable to connect to cache daemon: No error
Username for xx
^C

jpyeron@black /projects/dcarr/saar
$ ls -al ~/.git-credential-cache/
total 1
drwx--+ 1 jpyeron Domain Users 0 Jun  9 14:09 .
drwxr-xr-x+ 1 jpyeron root 0 Jun  8 22:45 ..
srwxr-xr-x  1 jpyeron Domain Users 0 Jun  9 14:09 socket

jpyeron@black /projects/dcarr/saar
$ rm -f ~/.git-credential-cache/socket

jpyeron@black /projects/dcarr/saar
$ git push
Username for xx
Password for xxx
Counting objects: 27, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (14/14), 2.09 KiB, done.
Total 14 (delta 6), reused 0 (delta 0)
To x
   345112c..48909da  master - master

jpyeron@black /projects/dcarr/saar
$ git --version
git version 1.7.9

jpyeron@black /projects/dcarr/saar
$ cygcheck.exe -V
cygcheck (cygwin) 1.7.30
...

-Jason


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-   -
- Jason Pyeron  PD Inc. http://www.pdinc.us -
- Principal Consultant  10 West 24th Street #100-
- +1 (443) 269-1555 x333Baltimore, Maryland 21218   -
-   -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-06-15 Thread Jeff King
On Sun, Jun 15, 2014 at 09:48:24AM -0400, Jason Pyeron wrote:

 Whenever my computer crashes, I am left with a socket file. On next git
 invocation it tries to conenct to the file, but the daemon is not running so 
 it
 barfs until I delete the file.

It's supposed to transparently handle this situation. The server always
runs unlink() before binding to clear it out. The client will spawn the
server when it tries to connect and gets either ENOENT or ECONNREFUSED.

But:

 jpyeron@black /projects/dcarr/saar
 $ git push
 fatal: unable to connect to cache daemon: No error

Apparently your errno is 0 after returning an error from
credential-cache.c:send_request?

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

in such a case.

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-06-15 Thread Jason Pyeron
 -Original Message-
 From: Jeff King  
 Sent: Sunday, June 15, 2014 10:08
 
 On Sun, Jun 15, 2014 at 09:48:24AM -0400, Jason Pyeron wrote:
 
  Whenever my computer crashes, I am left with a socket file. 
 On next git
  invocation it tries to conenct to the file, but the daemon 
 is not running so it
  barfs until I delete the file.
 
 It's supposed to transparently handle this situation. The 
 server always
 runs unlink() before binding to clear it out. The client will 
 spawn the
 server when it tries to connect and gets either ENOENT or 
 ECONNREFUSED.
 
 But:
 
  jpyeron@black /projects/dcarr/saar
  $ git push
  fatal: unable to connect to cache daemon: No error
 
 Apparently your errno is 0 after returning an error from
 credential-cache.c:send_request?
 
 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

It paused at:
snip/
   24  797029 [main] git 5112 fhandler_base::close: closing
'/cygdrive/c/home/public/Desktop/projects/dcarr/saar/.git/config' handle 0x2D4
   70  797099 [main] git 5112 close: 0 = close(3)
  899  797998 [main] git 5112 fhandler_pipe::create: name
\\.\pipe\cygwin-c5e39b7a9d22bafb-5112-pipe-0x1, size 65536, mode
PIPE_TYPE_MESSAGE
  316  798314 [main] git 5112 fhandler_pipe::create: pipe read handle 0x2C4
   27  798341 [main] git 5112 fhandler_pipe::create: CreateFile: name
\\.\pipe\cygwin-c5e39b7a9d22bafb-5112-pipe-0x1
   63  798404 [main] git 5112 fhandler_pipe::create: pipe write handle 0x2C0
   35  798439 [main] git 5112 build_fh_pc: fh 0x612ADE68, dev 00C6
   25  798464 [main] git 5112 build_fh_pc: fh 0x612B9B4C, dev 00C5
   24  798488 [main] git 5112 fhandler_base::set_flags: flags 0x1,
supplied_bin 0x0
   23  798511 [main] git 5112 fhandler_base::set_flags: O_TEXT/O_BINARY set in
flags 0x1
   22  798533 [main] git 5112 fhandler_base::set_flags: filemode set to binary
   22  798555 [main] git 5112 fhandler_base::init: created new fhandler_base for
handle 0x2C4, bin 1
   26  798581 [main] git 5112 fhandler_base::set_flags: flags 0x10001,
supplied_bin 0x0
   26  798607 [main] git 5112 fhandler_base::set_flags: O_TEXT/O_BINARY set in
flags 0x1
   22  798629 [main] git 5112 fhandler_base::set_flags: filemode set to binary
   23  798652 [main] git 5112 fhandler_base::init: created new fhandler_base for
handle 0x2C0, bin 1
   23  798675 [main] git 5112 fhandler_pipe::create: 0 = pipe([0x612ADE68,
0x612B9B4C], 65536, 0x1)
   26  798701 [main] git 5112 pipe: 0 = pipe([3, 4])
   28  798729 [main] git 5112 child_info::child_info: subproc_ready 0x2B4
   25  798754 [main] git 5112 fork: entering
  181  798935 [main] git 5112 sig_send: sendsig 0x350, pid 5112, signal -40,
its_me 1
   24  798959 [main] git 5112 sig_send: wakeup 0x2AC
   27  798986 [main] git 5112 sig_send: Waiting for pack.wakeup 0x2AC
6  798992 [sig] git 5112 wait_sig: signalling pack.wakeup 0x2AC
  280  799272 [main] git 5112 sig_send: returning 0x0 from sending signal -40
   39  799311 [main] git 5112 frok::parent: priority class 32
   86  799397 [main] git 5112 frok::parent: stack - bottom 0x23, top
0x207000, addr 0x3, guardsize 0x0
   25  799422 [main] git 5112 frok::parent: CreateProcessW
(C:\cygwin\bin\git.exe, C:\cygwin\bin\git.exe, 0, 0, 1, 0x420, 0, 0, 0x22A8FC,
0x22A8D0)
 2529  801951 [main] git 5112 frok::parent: forked pid 5796
  213  802164 [main] git 5112 child_info::sync: n 2, waiting for
subproc_ready(0x2B4) and child process(0x290)

Should I have changed example.com to something else and should I have run it
inside or outside of a git project directory?


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-   -
- Jason Pyeron  PD Inc. http://www.pdinc.us -
- Principal Consultant  10 West 24th Street #100-
- +1 (443) 269-1555 x333Baltimore, Maryland 21218   -
-   -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-06-15 Thread Jason Pyeron
 -Original Message-
 From: Jeff King  
 Sent: Sunday, June 15, 2014 10:08
 
 On Sun, Jun 15, 2014 at 09:48:24AM -0400, Jason Pyeron wrote:
 
  Whenever my computer crashes, I am left with a socket file. 
 On next git
  invocation it tries to conenct to the file, but the daemon 
 is not running so it
  barfs until I delete the file.
 
 It's supposed to transparently handle this situation. The 
 server always
 runs unlink() before binding to clear it out. The client will 
 spawn the
 server when it tries to connect and gets either ENOENT or 
 ECONNREFUSED.
 
 But:
 
  jpyeron@black /projects/dcarr/saar
  $ git push
  fatal: unable to connect to cache daemon: No error
 
 Apparently your errno is 0 after returning an error from
 credential-cache.c:send_request?
 
 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.

I marked the start of interest with lots of ***

jpyeron@black /projects/dcarr
$ echo url=https://example.com | strace -f
/usr/lib/git-core/git-credential-cache get
3   3 [main] git-credential-cache (4308)
**
  111 114 [main] git-credential-cache (4308) Program name:
C:\cygwin\lib\git-core\git-credential-cache.exe (windows pid 4308)
   53 167 [main] git-credential-cache (4308) OS version:   Windows NT-5.2
   50 217 [main] git-credential-cache (4308)
**
  138 355 [main] git-credential-cache (4308) sigprocmask: 0 = sigprocmask
(0, 0x0, 0x61276808)
  364 719 [main] git-credential-cache 4308 open_shared: name shared.5, n 5,
shared 0x60FF (wanted 0x60FF), h 0x368, *m 6
   68 787 [main] git-credential-cache 4308 user_heap_info::init: heap base
0x8000, heap top 0x8000, heap size 0x1800 (402653184)
   73 860 [main] git-credential-cache 4308 open_shared: name $$SID$$.1, n 1,
shared 0x60FE (wanted 0x60FE), h 0x36C, *m 6
   53 913 [main] git-credential-cache 4308 user_info::create: opening user
shared for '$$SID$$' at 0x60FE
   64 977 [main] git-credential-cache 4308 user_info::create: user shared
version AB1FCCE8
   611038 [main] git-credential-cache 4308 wow64_eval_expected_main_stack:
expected allocbase: 0x3, stackbase: 0x23
   681106 [main] git-credential-cache 4308 fhandler_pipe::create: name
\\.\pipe\cygwin-c5e39b7a9d22bafb-4308-sigwait, size 164, mode PIPE_TYPE_MESSAGE
  1101216 [main] git-credential-cache 4308 fhandler_pipe::create: pipe read
handle 0x354
   511267 [main] git-credential-cache 4308 fhandler_pipe::create:
CreateFile: name \\.\pipe\cygwin-c5e39b7a9d22bafb-4308-sigwait
   911358 [main] git-credential-cache 4308 fhandler_pipe::create: pipe write
handle 0x350
   621420 [main] git-credential-cache 4308 dll_crt0_0: finished dll_crt0_0
initialization
  7082128 [main] git-credential-cache 4308 mount_info::conv_to_posix_path:
conv_to_posix_path (C:\home\public\Desktop\projects\dcarr, no-keep-rel,
no-add-slash)
   692197 [main] git-credential-cache 4308 normalize_win32_path:
C:\home\public\Desktop\projects\dcarr = normalize_win32_path
(C:\home\public\Desktop\projects\dcarr)
   452242 [main] git-credential-cache 4308 mount_info::conv_to_posix_path:
/cygdrive/c/home/public/Desktop/projects/dcarr = conv_to_posix_path
(C:\home\public\Desktop\projects\dcarr)
 -1042138 [sig] git-credential-cache 4308 wait_sig: entering ReadFile loop,
my_readsig 0x354, my_sendsig 0x350
  2672405 [main] git-credential-cache 4308 sigprocmask: 0 = sigprocmask (0,
0x0, 0x800180A8)
  2372642 [main] git-credential-cache 4308 _cygwin_istext_for_stdio: fd 0:
not open
   602702 [main] git-credential-cache 4308 _cygwin_istext_for_stdio: fd 1:
not open
   372739 [main] git-credential-cache 4308 _cygwin_istext_for_stdio: fd 2:
not open
  1472886 [main] git-credential-cache (4308) open_shared: name cygpid.4308,
n 4308, shared 0x60FD (wanted 0x60FD), h 0x330, *m 2
   302916 [main] ? (4308) time: 1402843072 = time(0x0)
   422958 [main] git-credential-cache 4308 pinfo::thisproc: myself
dwProcessId 4308
  6453603 [main] git-credential-cache 4308 environ_init:
GetEnvironmentStrings returned 0x494040
   503653 [main] git-credential-cache 4308 environ_init: 0x80028290: !::=::\
   543707 [main] git-credential-cache 4308 environ_init: 0x800282A0: !A:=A:\
   783785 [main] git-credential-cache 4308 environ_init: 0x800282B0: !B:=B:\
   833868 [main] git-credential-cache 4308 environ_init: 0x800282C0: !D:=D:\
   723940 [main] git-credential-cache 4308 environ_init: 0x800282D0: !E:=E:\
   563996 [main] git-credential-cache 4308 environ_init: 0x800282E0: !F:=F:\
   754071 [main] git-credential-cache 4308 environ_init: 0x800282F0: !G:=G:\
   724143 [main] git-credential-cache 4308