hanw / git-repo

Automatically exported from code.google.com/p/git-repo
Apache License 2.0
0 stars 0 forks source link

Multiple git instances launched by repo compete for SSH key passphrase user input #178

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Affected Version: VERSION = (1, 21)

STEPS TO REPRODUCE:
1) Use SSH keys protected with a passphrase;
2) repo init --no-repo-verify -u git@github.com:foo/bar.git

repo quite obviously launches more than a single instance of git, and each 
instance attempts to attach to STDIN in order to wait for the user to enter 
passphrase:

-----
Enter passphrase for key '/home/eligovm/.ssh/id_rsa': Enter passphrase for key 
'/home/eligovm/.ssh/id_rsa':
-----

at which point race condition for user input ensues.

EXPECTED ACTION: instances of git DO NOT run in parallel, allowing the user to 
enter key passphrase for each instance separately, without interference from 
the other.

Original issue reported on code.google.com by raske...@eligoenergy.com on 6 Aug 2014 at 9:29

GoogleCodeExporter commented 9 years ago
OK, I found that the problem lies in the fact that "['ssh', '-M', '-N', '-o', 
'ControlPath" is not given the opportuinty to obtain the passphrase.

I changed the code in git_config.py around line 457::

    try:
      Trace(': %s', ' '.join(command))
      print(command)
      p = subprocess.Popen(command)
      time.sleep(10) <<<<<<<<<<<<<<<<<<<<<< added this

Then I have enough time to enter the passphrase, and after that everything 
works automatically.

Original comment by raske...@eligoenergy.com on 6 Aug 2014 at 9:49