From: Michael Albinus Date: Sun, 7 Jun 2020 14:56:59 +0000 (+0200) Subject: Tramp code cleanup X-Git-Tag: emacs-28.0.90~7200 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=54e840a8b44712eff63929c01a916531051c3e0b;p=emacs.git Tramp code cleanup * lisp/net/tramp-cache.el (tramp-get-connection-property): Cleanup. * lisp/net/tramp-cmds.el (tramp-cleanup-all-connections): Delete also connection processes. * lisp/net/tramp-sh.el (tramp-set-remote-path): Cache 4096 even if PIPE_BUF doesn't exist. --- diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 02400f9deb5..970e2eea0ac 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -142,7 +142,7 @@ Return DEFAULT if not set." (cached (and (hash-table-p hash) (gethash property hash))) (cached-at (and (consp cached) (format-time-string "%T" (car cached)))) (value default) - use-cache) + cache-used) (when ;; We take the value only if there is any, and ;; `remote-file-name-inhibit-cache' indicates that it is @@ -157,11 +157,11 @@ Return DEFAULT if not set." (time-less-p remote-file-name-inhibit-cache (car cached))))) (setq value (cdr cached) - use-cache t)) + cache-used t)) - (tramp-message key 8 "%s %s %s; inhibit: %s; cache used: %s; cached at: %s" - file property value - remote-file-name-inhibit-cache use-cache cached-at) + (tramp-message + key 8 "%s %s %s; inhibit: %s; cache used: %s; cached at: %s" + file property value remote-file-name-inhibit-cache cache-used cached-at) (when (>= tramp-verbose 10) (let* ((var (intern (concat "tramp-cache-get-count-" property))) (val (or (numberp (bound-and-true-p var)) @@ -320,15 +320,15 @@ the connection, return DEFAULT." (gethash property hash tramp-cache-undefined) tramp-cache-undefined)) (value default) - use-cache) + cache-used) (when (and (not (eq cached tramp-cache-undefined)) ;; If the key is an auxiliary process object, check ;; whether the process is still alive. (not (and (processp key) (not (process-live-p key))))) (setq value cached - use-cache t)) - (tramp-message key 7 "%s %s; cache used: %s" property value use-cache) + cache-used t)) + (tramp-message key 7 "%s %s; cache used: %s" property value cache-used) value)) ;;;###tramp-autoload diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 1742da86301..2805f6648ce 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -184,8 +184,9 @@ This includes password cache, file cache, connection cache, buffers." ;; Cancel timers. (cancel-function-timers 'tramp-timeout-session) - ;; Remove buffers. + ;; Remove processes and buffers. (dolist (name (tramp-list-tramp-buffers)) + (when (processp (get-buffer-process name)) (delete-process name)) (when (bufferp (get-buffer name)) (kill-buffer name))) ;; The end. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 523663cafbd..a3ce436e42a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4049,10 +4049,9 @@ variable PATH." (format "PATH=%s; export PATH" (string-join (tramp-get-remote-path vec) ":"))) (pipe-buf - (or (with-tramp-connection-property vec "pipe-buf" - (tramp-send-command-and-read - vec "getconf PIPE_BUF / 2>/dev/null || echo nil" 'noerror)) - 4096)) + (with-tramp-connection-property vec "pipe-buf" + (tramp-send-command-and-read + vec "getconf PIPE_BUF / 2>/dev/null || echo 4096" 'noerror))) tmpfile) (tramp-message vec 5 "Setting $PATH environment variable") (if (< (length command) pipe-buf)