Subject: cygwin git terminal won't capture password
From: Faisal Memon <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Thu, 7 Apr 2011 20:47:45 +0100 (BST)
List-Id: <cygwin.cygwin.com>

Hi,

When you use git from cygwin to clone a repo which requires a password, your 
password when typed comes out as plain text, instead of being taken from your 
terminal silently (without echo).  The clone thus fails.
The same local machine, but using linux command line shows the same repo 
working; it queries for password against the terminal session properly.

Good example using linux using strace to show system calls:
faisal@diamond:~/Desktop/0$ strace git clone 
https://[email-masked]/git/symbianapp.git
.
.
.
ioctl(2, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
pipe([3, 4])                            = 0
pipe([5, 6])                            = 0
pipe([7, 8])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0xb75a6728) = 3040
close(8)                                = 0
read(7, "", 1)                          = 0
close(7)                                = 0
close(3)                                = 0
close(6)                                = 0
dup(5)                                  = 3
fcntl64(3, F_GETFL)                     = 0 (flags O_RDONLY)
fstat64(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb773f000
_llseek(3, 0, 0xbfa15ed8, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
write(4, "capabilities\n", 13)          = 13
read(3, Password: 

We see it querying for password on the terminal in linux.

Contrasting that with cygwin which does not handle the password:
faisal@ruby ~/temp/1
$ strace git clone https://[email-masked]/git/symbianapp.git
.
.
.
36297  236291 [main] git-remote-https 7156 time: 1302204053 = time (0)
12732  249023 [main] git-remote-https 7156 __set_errno: virtual int 
fhandler_base::tcgetattr(termios*):1262 val 25
   18  249041 [main] git-remote-https 7156 __set_errno: virtual int 
fhandler_base::tcsetattr(int, const termios*):1255 val 25
   74  249115 [main] git-remote-https 7156 __set_errno: 
cygheap_fdget::cygheap_fdget(int, bool, bool):391 val 9
  261  249376 [main] git-remote-https 7156 fhandler_base::fstat: here
   17  249393 [main] git-remote-https 7156 time: 1302204053 = time (0)
   16  249409 [main] git-remote-https 7156 fstat64: 0 = fstat (0, 0x28C9C8)
   32  249441 [main] git-remote-https 7156 readv: readv (0, 0x28C9E4, 1) 
blocking, sigcatchers 0
   27  249468 [main] git-remote-https 7156 
fhandler_base_overlapped::wait_overlapped: normal read, 13 bytes
   16  249484 [main] git-remote-https 7156 fhandler_base::read: returning 13, 
binary mode
   14  249498 [main] git-remote-https 7156 readv: 13 = readv (0, 0x28C9E4, 1), 
errno 9
  149  249647 [main] git-remote-https 7156 __set_errno: 
cygheap_fdget::cygheap_fdget(int, bool, bool):391 val 9
  105  249752 [main] git-remote-https 7156 __set_errno: virtual int 
fhandler_base::tcsetattr(int, const termios*):1255 val 25
  152  249904 [main] git-remote-https 7156 readv: readv (0, 0x28CAE4, 1) 
blocking, sigcatchers 0

I am using git in cygwin version 1.7.4.  Cygwin is kicked off from the PuTTY 
program version 20101029
The same machine is running linux (via Virtual Box virtualisation), git version 
1.7.1

I've seen this problem reported elsewhere (stackoverflow) but no solution.

Any ideas what do to?

Thanks,
faisalmemonuk

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple