Skip to content

Commit 30abcda

Browse files
committed
Some Tramp fixes
* lisp/net/tramp.el (tramp-connectable-p): * lisp/net/tramp-cache.el (tramp-list-connections): * lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Bind `tramp-verbose' to 0. * lisp/net/tramp-sh.el (tramp-remote-path, tramp-find-executable): Fix docstring. (tramp-open-shell): Read prompt when moving "~/.editrc".
1 parent ac6ba68 commit 30abcda

File tree

4 files changed

+32
-20
lines changed

4 files changed

+32
-20
lines changed

lisp/net/tramp-cache.el

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -411,15 +411,16 @@ used to cache connection properties of the local machine."
411411
;;;###tramp-autoload
412412
(defun tramp-list-connections ()
413413
"Return all known `tramp-file-name' structs according to `tramp-cache'."
414-
(let (result tramp-verbose)
415-
(maphash
416-
(lambda (key _value)
417-
(when (and (tramp-file-name-p key)
418-
(null (tramp-file-name-localname key))
419-
(tramp-connection-property-p key "process-buffer"))
420-
(push key result)))
421-
tramp-cache-data)
422-
result))
414+
(let ((tramp-verbose 0)
415+
result)
416+
(maphash
417+
(lambda (key _value)
418+
(when (and (tramp-file-name-p key)
419+
(null (tramp-file-name-localname key))
420+
(tramp-connection-property-p key "process-buffer"))
421+
(push key result)))
422+
tramp-cache-data)
423+
result))
423424

424425
(defun tramp-dump-connection-properties ()
425426
"Write persistent connection properties into file `tramp-persistency-file-name'."

lisp/net/tramp-gvfs.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2466,7 +2466,8 @@ This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi."
24662466

24672467
(when tramp-gvfs-enabled
24682468
;; Suppress D-Bus error messages and Tramp traces.
2469-
(let (tramp-gvfs-dbus-event-vector tramp-verbose fun)
2469+
(let ((tramp-verbose 0)
2470+
tramp-gvfs-dbus-event-vector fun)
24702471
;; Add completion functions for services announced by DNS-SD.
24712472
;; See <http://www.dns-sd.org/ServiceTypes.html> for valid service types.
24722473
(zeroconf-init tramp-gvfs-zeroconf-domain)

lisp/net/tramp-sh.el

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ The string is used in `tramp-methods'.")
491491
For every remote host, this variable will be set buffer local,
492492
keeping the list of existing directories on that host.
493493

494-
You can use `~' in this list, but when searching for a shell which groks
495-
tilde expansion, all directory names starting with `~' will be ignored.
494+
You can use \"~\" in this list, but when searching for a shell which groks
495+
tilde expansion, all directory names starting with \"~\" will be ignored.
496496

497497
`Default Directories' represent the list of directories given by
498498
the command \"getconf PATH\". It is recommended to use this
@@ -3953,7 +3953,7 @@ hosts, or files, disagree."
39533953
First arg VEC specifies the connection, PROGNAME is the program
39543954
to search for, and DIRLIST gives the list of directories to
39553955
search. If IGNORE-TILDE is non-nil, directory names starting
3956-
with `~' will be ignored. If IGNORE-PATH is non-nil, searches
3956+
with \"~\" will be ignored. If IGNORE-PATH is non-nil, searches
39573957
only in DIRLIST.
39583958

39593959
Returns the absolute file name of PROGNAME, if found, and nil otherwise.
@@ -4103,18 +4103,26 @@ file exists and nonzero exit status otherwise."
41034103
(with-tramp-progress-reporter
41044104
vec 5 (format-message "Opening remote shell `%s'" shell)
41054105
;; Find arguments for this shell.
4106-
(let ((extra-args (tramp-get-sh-extra-args shell)))
4106+
(let ((extra-args (tramp-get-sh-extra-args shell))
4107+
(p (tramp-get-connection-process vec)))
41074108
;; The readline library can disturb Tramp. For example, the
41084109
;; very recent version of libedit, the *BSD implementation of
41094110
;; readline, confuses Tramp. So we disable line editing. Since
41104111
;; $EDITRC is not supported on all target systems, we must move
41114112
;; ~/.editrc temporarily somewhere else. For bash and zsh we
41124113
;; have disabled this already during shell invocation, see
4113-
;; `tramp-sh-extra-args'. Bug#39399.
4114+
;; `tramp-sh-extra-args' (Bug#39399).
4115+
;; The shell prompt might not be set yet, so we must read any
4116+
;; prompt via `tramp-barf-if-no-shell-prompt'.
41144117
(unless extra-args
4115-
(tramp-send-command vec "rm -f ~/.editrc.tramp" t)
4116-
(tramp-send-command vec "mv -f ~/.editrc ~/.editrc.tramp" t)
4117-
(tramp-send-command vec "echo 'edit off' >~/.editrc" t))
4118+
(tramp-send-command vec "rm -f ~/.editrc.tramp" t t)
4119+
(tramp-barf-if-no-shell-prompt p 10 "Couldn't find remote shell prompt")
4120+
(tramp-send-command
4121+
vec "test -e ~/.editrc && mv -f ~/.editrc ~/.editrc.tramp" t t)
4122+
(tramp-barf-if-no-shell-prompt p 10 "Couldn't find remote shell prompt")
4123+
(tramp-send-command vec "echo 'edit off' >~/.editrc" t t)
4124+
(tramp-barf-if-no-shell-prompt
4125+
p 10 "Couldn't find remote shell prompt"))
41184126
;; It is useful to set the prompt in the following command
41194127
;; because some people have a setting for $PS1 which /bin/sh
41204128
;; doesn't know about and thus /bin/sh will display a strange
@@ -4150,7 +4158,9 @@ file exists and nonzero exit status otherwise."
41504158
(tramp-shell-quote-argument tramp-end-of-output)
41514159
shell (or extra-args ""))
41524160
t)
4161+
;; Reset ~/.editrc.
41534162
(unless extra-args
4163+
(tramp-send-command vec "rm -f ~/.editrc" t)
41544164
(tramp-send-command
41554165
vec "test -e ~/.editrc.tramp && mv -f ~/.editrc.tramp ~/.editrc" t))
41564166
;; Check proper HISTFILE setting. We give up when not working.

lisp/net/tramp.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,7 +2555,7 @@ Add operations defined in `HANDLER-alist' to `tramp-file-name-handler'."
25552555
"Check, whether it is possible to connect the remote host w/o side-effects.
25562556
This is true, if either the remote host is already connected, or if we are
25572557
not in completion mode."
2558-
(let (tramp-verbose
2558+
(let ((tramp-verbose 0)
25592559
(vec
25602560
(cond
25612561
((tramp-file-name-p vec-or-filename) vec-or-filename)
@@ -3431,7 +3431,7 @@ User is always nil."
34313431
(with-tramp-progress-reporter v 0 (format "Opening directory %s" filename)
34323432
(let (ls-lisp-use-insert-directory-program start)
34333433
;; Silence byte compiler.
3434-
ls-lisp-use-insert-directory-program
3434+
(ignore ls-lisp-use-insert-directory-program)
34353435
(tramp-run-real-handler
34363436
#'insert-directory
34373437
(list filename switches wildcard full-directory-p))

0 commit comments

Comments
 (0)