Adapt Tramp's sudo method for non-default shells (Bug#31924)

* lisp/net/tramp-sh.el (tramp-methods) <sudo>: Change template.
(tramp-maybe-open-connection): Remove `tramp-login-env'.  (Bug#31924)

* lisp/net/tramp.el (tramp-methods): Remove docstring for `tramp-login-env'.
This commit is contained in:
Michael Albinus 2019-10-16 15:09:46 +02:00
parent b6babe9b44
commit b70f885d58
2 changed files with 2 additions and 29 deletions

View file

@ -279,11 +279,8 @@ The string is used in `tramp-methods'.")
;; it could be interpreted as password prompt if the
;; remote host echoes the command.
(tramp-login-args (("-u" "%u") ("-s") ("-H")
("-p" "P\"\"a\"\"s\"\"s\"\"w\"\"o\"\"r\"\"d\"\":")))
;; Local $SHELL could be a nasty one, like zsh or
;; fish. Let's override it.
(tramp-login-env (("SHELL")
(,tramp-default-remote-shell)))
("-p" "P\"\"a\"\"s\"\"s\"\"w\"\"o\"\"r\"\"d\"\":")
("%l")))
(tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
@ -4912,8 +4909,6 @@ connection if a previous connection has died for some reason."
(remote-shell
(tramp-get-method-parameter hop 'tramp-remote-shell))
(extra-args (tramp-get-sh-extra-args remote-shell))
(login-env
(tramp-get-method-parameter hop 'tramp-login-env))
(async-args
(tramp-get-method-parameter hop 'tramp-async-args))
(connection-timeout
@ -4963,24 +4958,6 @@ connection if a previous connection has died for some reason."
(tramp-get-method-parameter
hop 'tramp-session-timeout)))
;; Add login environment.
(when login-env
(setq
login-env
(mapcar
(lambda (x)
(setq x (mapcar (lambda (y) (format-spec y spec)) x))
(unless (member "" x) (string-join x " ")))
login-env))
(while login-env
(setq command
(format
"%s=%s %s"
(pop login-env)
(tramp-shell-quote-argument (pop login-env))
command)))
(setq command (concat "env " command)))
;; Replace `login-args' place holders.
(setq
l-host (or l-host "")

View file

@ -240,10 +240,6 @@ pair of the form (KEY VALUE). The following KEYs are defined:
absence of `tramp-copy-args', is an indication that the
method is capable of multi-hops.
* `tramp-login-env'
A list of environment variables and their values, which will
be set when calling `tramp-login-program'.
* `tramp-async-args'
When an asynchronous process is started, we know already that
the connection works. Therefore, we can pass additional