emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9e8ac1f: Revert use of powershell in Tramp, there are collateral


From: Michael Albinus
Subject: master 9e8ac1f: Revert use of powershell in Tramp, there are collateral damages
Date: Thu, 8 Apr 2021 06:24:53 -0400 (EDT)

branch: master
commit 9e8ac1f5be755a5618792b5b100915c2730c9d61
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Revert use of powershell in Tramp, there are collateral damages
    
    * lisp/net/tramp-sh.el (tramp-methods) <sshx, scpx>: Fix quoting
    for MS Windows.
    (tramp-connection-properties): Don't set "encoding-shell".
    (tramp-actions-before-shell): Remove `tramp-no-job-control-regexp'.
    (tramp-maybe-open-connection): Revert changes for "encoding-shell".
    
    * lisp/net/tramp.el (tramp-no-job-control-regexp): Remove.
---
 lisp/net/tramp-sh.el | 33 ++++++++++++---------------------
 lisp/net/tramp.el    |  9 ---------
 2 files changed, 12 insertions(+), 30 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index b902ee6..8db9dd9 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -169,7 +169,8 @@ The string is used in `tramp-methods'.")
                 (tramp-login-program        "ssh")
                 (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
                                             ("-e" "none") ("-t" "-t")
-                                            ("-o" "RemoteCommand='%l'") 
("%h")))
+                                            ("-o" "RemoteCommand=\"%l\"")
+                                            ("%h")))
                 (tramp-async-args           (("-q")))
                 (tramp-remote-shell         ,tramp-default-remote-shell)
                 (tramp-remote-shell-login   ("-l"))
@@ -225,7 +226,8 @@ The string is used in `tramp-methods'.")
                 (tramp-login-program        "ssh")
                 (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
                                             ("-e" "none") ("-t" "-t")
-                                            ("-o" "RemoteCommand='%l'") 
("%h")))
+                                            ("-o" "RemoteCommand=\"%l\"")
+                                            ("%h")))
                 (tramp-async-args           (("-q")))
                 (tramp-remote-shell         ,tramp-default-remote-shell)
                 (tramp-remote-shell-login   ("-l"))
@@ -389,14 +391,7 @@ The string is used in `tramp-methods'.")
                  (regexp-opt
                   '("rcp" "remcp" "rsh" "telnet" "nc" "krlogin" "fcp"))
                  "\\'")
-               nil ,(user-login-name)))
-
- ;; MS Windows Openssh client does not cooperate well with cmdproxy.
- (when-let ((encoding-shell
-            (and (eq system-type 'windows-nt) (executable-find "powershell"))))
-   (add-to-list 'tramp-connection-properties
-               `(,(regexp-opt '("/sshx:" "/scpx:"))
-                  "encoding-shell" ,encoding-shell))))
+               nil ,(user-login-name))))
 
 ;;;###tramp-autoload
 (defconst tramp-completion-function-alist-rsh
@@ -491,7 +486,6 @@ shell from reading its init file."
   '((tramp-login-prompt-regexp tramp-action-login)
     (tramp-password-prompt-regexp tramp-action-password)
     (tramp-wrong-passwd-regexp tramp-action-permission-denied)
-    (tramp-no-job-control-regexp tramp-action-permission-denied)
     (shell-prompt-pattern tramp-action-succeed)
     (tramp-shell-prompt-pattern tramp-action-succeed)
     (tramp-yesno-prompt-regexp tramp-action-yesno)
@@ -4804,6 +4798,8 @@ connection if a previous connection has died for some 
reason."
                      (setenv "HISTSIZE" "0"))))
              (setenv "PROMPT_COMMAND")
              (setenv "PS1" tramp-initial-end-of-output)
+              (unless (stringp tramp-encoding-shell)
+                (tramp-error vec 'file-error "`tramp-encoding-shell' not set"))
              (let* ((current-host tramp-system-name)
                     (target-alist (tramp-compute-multi-hops vec))
                     ;; We will apply `tramp-ssh-controlmaster-options'
@@ -4815,23 +4811,17 @@ connection if a previous connection has died for some 
reason."
                     ;; W32 systems.
                     (process-coding-system-alist nil)
                     (coding-system-for-read nil)
-                    (encoding-shell
-                     (tramp-get-connection-property
-                      vec "encoding-shell" tramp-encoding-shell))
-                    (extra-args (tramp-get-sh-extra-args encoding-shell))
+                    (extra-args (tramp-get-sh-extra-args tramp-encoding-shell))
                     ;; This must be done in order to avoid our file
                     ;; name handler.
                     (p (let ((default-directory
                                (tramp-compat-temporary-file-directory)))
-                         (unless (stringp encoding-shell)
-                           (tramp-error
-                            vec 'file-error "`tramp-encoding-shell' not set"))
                          (apply
                           #'start-process
                           (tramp-get-connection-name vec)
                           (tramp-get-connection-buffer vec)
                           (append
-                           (list encoding-shell)
+                           (list tramp-encoding-shell)
                            (and extra-args (split-string extra-args))
                            (and tramp-encoding-command-interactive
                                 (list tramp-encoding-command-interactive)))))))
@@ -4850,7 +4840,8 @@ connection if a previous connection has died for some 
reason."
 
                ;; Check whether process is alive.
                (tramp-barf-if-no-shell-prompt
-                p 10 "Couldn't find local shell prompt for %s" encoding-shell)
+                p 10
+                "Couldn't find local shell prompt for %s" tramp-encoding-shell)
 
                ;; Now do all the connections as specified.
                (while target-alist
@@ -4925,7 +4916,7 @@ connection if a previous connection has died for some 
reason."
                        ?c (format-spec options (format-spec-make ?t tmpfile))
                        ?l (concat remote-shell " " extra-args " -i"))
                       ;; A restricted shell does not allow "exec".
-                      (when r-shell '("; exit")))
+                      (when r-shell '("&&" "exit" "||" "exit")))
                      " "))
 
                    ;; Send the command.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 99955b5..b2c650f 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -691,15 +691,6 @@ The regexp should match at end of buffer."
   :version "27.1"
   :type 'regexp)
 
-;; Powershell requires "ssh -t -t" for terminal emulation.  If it
-;; doesn't fit, there is an error.
-(defcustom tramp-no-job-control-regexp
-  (regexp-quote "Thus no job control in this shell.")
-  "Regular expression matching powershell's job control message.
-The regexp should match at end of buffer."
-  :version "28.1"
-  :type 'regexp)
-
 (defcustom tramp-operation-not-permitted-regexp
   (concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*"
          (regexp-opt '("Operation not permitted") t))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]