Bug 536108 - org.eclipse.jgit.transport.TransportGitSsh plink detection false positive
Summary: org.eclipse.jgit.transport.TransportGitSsh plink detection false positive
Status: NEW
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 4.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-20 18:06 EDT by Nikita Udovenko CLA
Modified: 2018-06-20 18:09 EDT (History)
0 users

See Also:


Attachments
Do putty detection only on the filename only (1.45 KB, patch)
2018-06-20 18:09 EDT, Nikita Udovenko CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Udovenko CLA 2018-06-20 18:06:58 EDT
org.eclipse.jgit.transport.TransportGitSsh class has Putty installation detection for Windows OS: 

> boolean putty = ssh.toLowerCase(Locale.ROOT).contains("plink")

Where ssh variable is:

> String ssh = SystemReader.getInstance().getenv("GIT_SSH");

Unfortunately for me, I ought to override GIT_SSH to point to a shell script, which has "plink" as a substring of one of its containing directories: $HOME/??pLink**/bin/ssh_robot. As a result, TransportGitSsh assumes I am on Windows, with Putty SSH installation, and adds to an SSH command a "-batch" attribute which is not supported by Linux SSH installations.

For now, I had to resort to renaming the project folder to something which doesn't have "plink" in the path. However, since putty binary is "plink.exe", I wonder if it would be acceptable make putty detection a little more robust for everybody, and look up the "plink" substring in the filename part only. I.e., given "$HOME/??pLink**/bin/ssh_robot" path, do the check on the "ssh_robot", rather than the full path.

A simplistic, Linux-only fix is attached as a patch file. It is based off of 4.7 version, but is similar or identical on all releases starting with at least 3.0.

If need be, I am willing to work on the proper patch, if there idea of the fix sounds OK.
Comment 1 Nikita Udovenko CLA 2018-06-20 18:09:06 EDT
Created attachment 274563 [details]
Do putty detection only on the filename only