Subject: Re: bug#63373: [PATCH] 30.0.50; Bug in tramp-ssh-controlmaster-options

From: "Benson Chu" <[email-masked]>
Date: Mon, 08 May 2023 10:14:59 -0500

Oops

On Mon, May 8, 2023, at 10:14 AM, Eli Zaretskii wrote:
>> From: Benson Chu <[email-masked]>
>> Date: Mon, 08 May 2023 09:56:28 -0500
>> 
>> 
>> Hello, I am using tramp with an old version of ssh (6.6.1), which
>> doesn't have the -G options. #'tramp-ssh-controlmaster-option is assumed
>> to return a string, and with my version of ssh,
>> #'tramp-ssh-controlmaster-option returns nil due to the recent changes
>> adding the "suppress" option.
>> 
>> This patch fixes the bug, returning an empty string where previously nil
>> was returned.
>
> ENOPATCH

From efade8d654ac90629b56c4566cef6d8695dad3fa Mon Sep 17 00:00:00 2001
From: Benson Chu <[email-masked]>
Date: Mon, 8 May 2023 09:46:44 -0500
Subject: [PATCH] ; tramp-ssh-controlmaster-options shouldn't return nil

* lisp/net/tramp-sh.el (tramp-ssh-controlmaster-options): should never
return nil, but empty string
---
 lisp/net/tramp-sh.el | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index d020615af07..221f6bef5f9 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4856,26 +4856,30 @@ tramp-ssh-controlmaster-options
          (stringp tramp-ssh-controlmaster-options))
     tramp-ssh-controlmaster-options)
 
+   ;; We can't auto-compute the options
+   ((ignore-errors
+      (not (tramp-ssh-option-exists-p vec "ControlMaster=auto")))
+    "")
+
    ;; Determine the options.
    (t (ignore-errors
         ;; ControlMaster and ControlPath options are introduced in OpenSSH 3.9.
-	(when (tramp-ssh-option-exists-p vec "ControlMaster=auto")
-          (concat
-           "-o ControlMaster="
-           (if (eq tramp-use-connection-share 'suppress)
-               "no" "auto")
-
-           " -o ControlPath="
-           (if (eq tramp-use-connection-share 'suppress)
-               "none"
-             ;; Hashed tokens are introduced in OpenSSH 6.7.
-	     (if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C")
-		 "tramp.%%C" "tramp.%%r@%%h:%%p"))
-
-           ;; ControlPersist option is introduced in OpenSSH 5.6.
-	   (when (and (not (eq tramp-use-connection-share 'suppress))
-                      (tramp-ssh-option-exists-p vec "ControlPersist=no"))
-	     " -o ControlPersist=no")))))))
+        (concat
+         "-o ControlMaster="
+         (if (eq tramp-use-connection-share 'suppress)
+             "no" "auto")
+
+         " -o ControlPath="
+         (if (eq tramp-use-connection-share 'suppress)
+             "none"
+           ;; Hashed tokens are introduced in OpenSSH 6.7.
+	   (if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C")
+	       "tramp.%%C" "tramp.%%r@%%h:%%p"))
+
+         ;; ControlPersist option is introduced in OpenSSH 5.6.
+	 (when (and (not (eq tramp-use-connection-share 'suppress))
+                    (tramp-ssh-option-exists-p vec "ControlPersist=no"))
+	   " -o ControlPersist=no"))))))
 
 (defun tramp-scp-strict-file-name-checking (vec)
   "Return the strict file name checking argument of the local scp."
-- 
2.40.0