git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: "brian m. carlson" <sandals@crustytoothpaste.net>, git@vger.kernel.org
Cc: "Jeff King" <peff@peff.net>, "Junio C Hamano" <gitster@pobox.com>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>,
	"Torsten Bögershausen" <tboegi@web.de>,
	jakanapes@gmail.com
Subject: Re: [PATCH v2 2/2] connect: improve check for plink to reduce false positives
Date: Sat, 25 Apr 2015 18:03:22 +0200	[thread overview]
Message-ID: <553BBACA.70704@web.de> (raw)
In-Reply-To: <1429914505-325708-2-git-send-email-sandals@crustytoothpaste.net>

On 2015-04-25 00.28, brian m. carlson wrote:
> The git_connect function has code to handle plink and tortoiseplink
> specially, as they require different command line arguments from
> OpenSSH.  However, the match was done by checking for "plink"
> case-insensitively in the string, which led to false positives when
> GIT_SSH contained "uplink".  Improve the check by looking for "plink" or
> "tortoiseplink" (or those names suffixed with ".exe") in the final
> component of the path.
> 
(I'm not sute if the commit message describes the problem deep enough
for readers which are not familar with all the details of the original
report):
A feature implemented for Windows may break things for e.g. Linux users)
The following may read exaggerated, so please read it as a suggestion.

The git_connect function has code to handle plink and tortoiseplink
specially, as they require different command line arguments compared to
OpenSSH (-P instead of -p, tortoiseplink uses -batch), commit 36ad53ffee6ed.
The special handling is only needed for Windows, and a sloppy
case-insensitve search for "plink" will trigger that an the extra
parameter "-batch" is added to the command line.

This was observed on a Linux system where a command line including
"/uplink_deploy/" was used.

There are different ways to improve the situation:
(The following mentions only plink, but assumes that tortoiseplink is handled
 similar)
a) Disable the plink/tortoiseplink special handling on non-Windows systems
b) Tighten the search for plink:
   Allow basename() == plink || !!strcasestr(ssh, "plink.exe")
c) Tighten the search for plink:
   Allow basename() == plink || !!strcasestr(ssh, "plink.exe")
d) Tighten the check for tortoiseplink.
   Today we set "int putty" to true when plink is found, and -batch
   is set when tortoiseplink is not found.
   This fixes the reported bug, but still has the -P problem.
e) Unix users typically use shell scripts and could use GIT_SSH_COMMAND.
   Declare the GIT_SSH as not-well-documented (and to obsolete ?) for non-Windows systems,


This patch implements c):
Extract the basename and compare it to plink, plink.exe respective
tortoiseplink/tortoiseplink.exe

Note that there is a slight risk of breakage for Windows users:
Strings like "myplink" or "plink-0.83" are no longer accepted.

-------------
I would probably vote for a), as Unix/Linux/Mac OS users don't use plink/tortoiseplink
at all. 
-------------
What about adding test-cases in t5601,
this will ease the documentation later.
f:/util/plink
/c/util/plink.exe
f:/util/tortoiseplink
/c/util/tortoiseplink.exe
/usr/local/uplink/sshwrapper.sh


Other opinions, other thoughts ?

  parent reply	other threads:[~2015-04-25 16:03 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22 14:36 [BUG] having 'plink' anywhere in the GIT_SSH environment variables sets putty = true Patrick Sharp
2015-04-22 17:46 ` Johannes Schindelin
2015-04-22 19:12   ` Patrick Sharp
2015-04-22 20:29     ` Jeff King
2015-04-22 21:19       ` brian m. carlson
2015-04-22 21:29         ` Jeff King
2015-04-22 21:44           ` brian m. carlson
2015-04-22 22:00             ` Jeff King
2015-04-22 22:24               ` brian m. carlson
2015-04-22 23:23                 ` Jeff King
2015-04-23  0:06                   ` [PATCH 1/2] connect: simplify SSH connection code path brian m. carlson
2015-04-23  0:06                     ` [PATCH 2/2] connect: improve check for plink to reduce false positives brian m. carlson
2015-04-23  6:50                       ` Johannes Schindelin
2015-04-23 15:53                         ` Jeff King
2015-04-23 23:14                           ` brian m. carlson
2015-04-24  6:41                             ` Johannes Schindelin
2015-04-24 22:28                             ` [PATCH v2 1/2] connect: simplify SSH connection code path brian m. carlson
2015-04-24 22:28                               ` [PATCH v2 2/2] connect: improve check for plink to reduce false positives brian m. carlson
2015-04-24 22:46                                 ` Pete Harlan
2015-04-24 22:48                                   ` brian m. carlson
2015-04-25 16:03                                 ` Torsten Bögershausen [this message]
2015-04-26 18:52                                   ` brian m. carlson
2015-04-26 20:30                               ` [PATCH v3 0/3] Improve robustness of putty detection brian m. carlson
2015-04-26 20:30                                 ` [PATCH v3 1/3] connect: simplify SSH connection code path brian m. carlson
2015-04-26 20:30                                 ` [PATCH v3 2/3] t5601: fix quotation error leading to skipped tests brian m. carlson
2015-04-26 20:30                                 ` [PATCH v3 3/3] connect: improve check for plink to reduce false positives brian m. carlson
2015-04-27  7:57                                   ` Johannes Schindelin
2015-04-28  3:53                                   ` Jeff King
2015-06-26 13:15                                   ` Jeff King
2015-06-26 16:16                                     ` Junio C Hamano
2015-06-26 16:27                                       ` Jeff King
2015-06-26 17:13                                         ` Johannes Schindelin
2015-06-26 17:23                                           ` Jeff King
2015-06-26 20:43                                     ` brian m. carlson
2015-04-26 22:04                                 ` [PATCH v3 0/3] Improve robustness of putty detection Junio C Hamano
2015-04-27 15:46                                   ` Torsten Bögershausen
2015-04-28  4:15                                   ` Jeff King
2015-04-29  1:38                                   ` brian m. carlson
2015-04-24  6:37                           ` [PATCH 2/2] connect: improve check for plink to reduce false positives Johannes Schindelin
2015-04-23  5:08     ` [BUG] having 'plink' anywhere in the GIT_SSH environment variables sets putty = true Torsten Bögershausen
2015-04-23 13:15       ` Patrick Sharp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=553BBACA.70704@web.de \
    --to=tboegi@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jakanapes@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).