Rev 2773: Fix detection of ssh implementation on Windows in http://sourcefrog.net/bzr/plink

Martin Pool mbp at sourcefrog.net
Fri Aug 31 06:38:11 BST 2007


At http://sourcefrog.net/bzr/plink

------------------------------------------------------------
revno: 2773
revision-id: mbp at sourcefrog.net-20070831053810-uibzfoh2s16lt93b
parent: pqm at pqm.ubuntu.com-20070831020510-emrlta5dk6ta95zp
parent: argentina at gmail.com-20070830201954-i1cn3pmft81zws9r
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: plink
timestamp: Fri 2007-08-31 15:38:10 +1000
message:
  Fix detection of ssh implementation on Windows
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/transport/ssh.py        ssh.py-20060824042150-0s9787kng6zv1nwq-1
    ------------------------------------------------------------
    revno: 2767.3.1
    revision-id: argentina at gmail.com-20070830201954-i1cn3pmft81zws9r
    parent: pqm at pqm.ubuntu.com-20070829161516-le0ppkanxngkjg69
    committer: Martin Albisetti <argentina at gmail.com>
    branch nick: bzr.beuno
    timestamp: Thu 2007-08-30 17:19:54 -0300
    message:
      Fixed bug #107155
    modified:
      bzrlib/transport/ssh.py        ssh.py-20060824042150-0s9787kng6zv1nwq-1
=== modified file 'NEWS'
--- a/NEWS	2007-08-31 02:05:10 +0000
+++ b/NEWS	2007-08-31 05:38:10 +0000
@@ -26,52 +26,55 @@
    * ``bzr plugins`` now lists the version number for each plugin in square
      brackets after the path. (Robert Collins, #125421)
 
-    * Suppress warning "integer argument expected, got float" from Paramiko,
-      which sometimes caused false test failures.  (Martin Pool)
-
-    * Fix bug in bundle 4 that could cause attempts to write data to wrong
-      versionedfile.  (Aaron Bentley)
-
-    * Diffs generated using "diff -p" no longer break the patch parser.
-      (Aaron Bentley)
-
-    * get_transport treats an empty possible_transports list the same as a non-
-      empty one.  (Aaron Bentley)
-
-    * patch verification for merge directives is reactivated, and works with
-      CRLF and CR files.  (Aaron Bentley)
-
-    * Accept ..\ as a path in revision specifiers. This fixes for example
-      "-r branch:..\other-branch" on Windows.  (Lukáš Lalinský) 
-
-    * ``BZR_PLUGIN_PATH`` may now contain trailing slashes.
-      (Blake Winton, #129299)
-
-    * man page no longer lists hidden options (#131667, Aaron Bentley)
-
-    * ``uncommit --help`` now explains the -r option adequately.  (Daniel
-      Watkins, #106726)
-
-    * Error messages are now better formatted with parameters (such as
-      filenames) quoted when necessary. This avoids confusion when directory
-      names ending in a '.' at the end of messages were confused with a
-      full stop that may or not have been there. (Daniel Watkins, #129791)
-
-    * Fix ``status FILE -r X..Y``. (Lukáš Lalinský)
-
-    * If a particular command is an alias, ``help`` will show the alias
-      instead of claiming there is no help for said alias. (Daniel Watkins,
-      #133548)
-
-    * TreeTransform-based operations, like pull, merge, revert, and branch,
-      now roll back if they encounter an error.  (Aaron Bentley, #67699)
-
-    * ``bzr commit`` now exits cleanly if a character unsupported by the
-      current encoding is used in the commit message.  (Daniel Watkins,
-      #116143)
-
-    * bzr send uses default values for ranges when only half of an elipsis
-      is specified ("-r..5" or "-r5..").  (#61685, Aaron Bentley)
+   * Suppress warning "integer argument expected, got float" from Paramiko,
+     which sometimes caused false test failures.  (Martin Pool)
+
+   * Fix bug in bundle 4 that could cause attempts to write data to wrong
+     versionedfile.  (Aaron Bentley)
+
+   * Diffs generated using "diff -p" no longer break the patch parser.
+     (Aaron Bentley)
+
+   * get_transport treats an empty possible_transports list the same as a non-
+     empty one.  (Aaron Bentley)
+
+   * patch verification for merge directives is reactivated, and works with
+     CRLF and CR files.  (Aaron Bentley)
+
+   * Accept ..\ as a path in revision specifiers. This fixes for example
+     "-r branch:..\other-branch" on Windows.  (Lukáš Lalinský) 
+
+   * ``BZR_PLUGIN_PATH`` may now contain trailing slashes.
+     (Blake Winton, #129299)
+
+   * man page no longer lists hidden options (#131667, Aaron Bentley)
+
+   * ``uncommit --help`` now explains the -r option adequately.  (Daniel
+     Watkins, #106726)
+
+   * Error messages are now better formatted with parameters (such as
+     filenames) quoted when necessary. This avoids confusion when directory
+     names ending in a '.' at the end of messages were confused with a
+     full stop that may or not have been there. (Daniel Watkins, #129791)
+
+   * Fix ``status FILE -r X..Y``. (Lukáš Lalinský)
+
+   * If a particular command is an alias, ``help`` will show the alias
+     instead of claiming there is no help for said alias. (Daniel Watkins,
+     #133548)
+
+   * TreeTransform-based operations, like pull, merge, revert, and branch,
+     now roll back if they encounter an error.  (Aaron Bentley, #67699)
+
+   * ``bzr commit`` now exits cleanly if a character unsupported by the
+     current encoding is used in the commit message.  (Daniel Watkins,
+     #116143)
+
+   * bzr send uses default values for ranges when only half of an elipsis
+     is specified ("-r..5" or "-r5..").  (#61685, Aaron Bentley)
+
+   * Avoid trouble when Windows ssh calls itself 'plink' but no plink
+     binary is present.  (Martin Albisetti, #107155)
 
   IMPROVEMENTS:
 

=== modified file 'bzrlib/transport/ssh.py'
--- a/bzrlib/transport/ssh.py	2007-05-12 19:05:12 +0000
+++ b/bzrlib/transport/ssh.py	2007-08-31 05:38:10 +0000
@@ -114,10 +114,11 @@
             stdout = stderr = ''
         return stdout + stderr
 
-    def _get_vendor_by_version_string(self, version):
+    def _get_vendor_by_version_string(self, version, args):
         """Return the vendor or None based on output from the subprocess.
 
         :param version: The output of 'ssh -V' like command.
+        :param args: Command line that was run.
         """
         vendor = None
         if 'OpenSSH' in version:
@@ -126,7 +127,10 @@
         elif 'SSH Secure Shell' in version:
             mutter('ssh implementation is SSH Corp.')
             vendor = SSHCorpSubprocessVendor()
-        elif 'plink' in version:
+        elif 'plink' in version and args[0] == 'plink':
+            # Checking if "plink" was the executed argument as Windows sometimes 
+            # reports 'ssh -V' incorrectly with 'plink' in it's version. 
+            # See https://bugs.launchpad.net/bzr/+bug/107155
             mutter("ssh implementation is Putty's plink.")
             vendor = PLinkSubprocessVendor()
         return vendor
@@ -135,7 +139,7 @@
         """Return the vendor or None by checking for known SSH implementations."""
         for args in [['ssh', '-V'], ['plink', '-V']]:
             version = self._get_ssh_version_string(args)
-            vendor = self._get_vendor_by_version_string(version)
+            vendor = self._get_vendor_by_version_string(version, args)
             if vendor is not None:
                 return vendor
         return None




More information about the bazaar-commits mailing list