diff options
| author | Michael Albinus | 2020-03-29 12:24:04 +0200 |
|---|---|---|
| committer | Michael Albinus | 2020-03-29 12:24:04 +0200 |
| commit | 76b3bd8cbb9a0a01941d9c1766c054960e4bfd97 (patch) | |
| tree | cd3f86e50b8930cdfa7d1acc724deefcef70a0c3 | |
| parent | 96e53675eaee9f4fcfa966aab643b94608299118 (diff) | |
| download | emacs-76b3bd8cbb9a0a01941d9c1766c054960e4bfd97.tar.gz emacs-76b3bd8cbb9a0a01941d9c1766c054960e4bfd97.zip | |
Improve Tramp cache for asynchronous processes
* lisp/net/tramp-adb.el (tramp-adb-handle-exec-path)
(tramp-adb-get-device):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handler-askquestion):
* lisp/net/tramp-sh.el (tramp-remote-selinux-p, tramp-remote-acl-p)
(tramp-open-connection-setup-interactive-shell)
(tramp-maybe-open-connection, tramp-get-remote-path)
(tramp-get-inline-compress, tramp-get-inline-coding):
* lisp/net/tramp-smb.el (tramp-smb-get-cifs-capabilities)
(tramp-smb-get-stat-capability):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-remote-acl-p)
(tramp-sudoedit-remote-selinux-p): Cache property in main process.
* lisp/net/tramp-cache.el (tramp-cache-undefined): New defconst.
(tramp-get-hash-table, tramp-connection-property-p): Use it.
(tramp-set-connection-property, tramp-flush-connection-property)
(tramp-flush-connection-properties): Add sanity checks.
(tramp-get-file-property, tramp-set-file-property)
(tramp-get-connection-property, tramp-set-connection-property)
(tramp-dump-connection-properties): Adapt docstring.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection): Delete all
processes.
* lisp/net/tramp-gvfs.el (tramp-gvfs-unmount):
Use `tramp-cleanup-connection'.
* lisp/net/tramp-sh.el (tramp-sh-handle-vc-registered):
Use `bound-and-true-p'.
* lisp/net/tramp.el (tramp-get-process): New defun.
| -rw-r--r-- | lisp/net/tramp-adb.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-cache.el | 94 | ||||
| -rw-r--r-- | lisp/net/tramp-cmds.el | 22 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 6 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 69 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 5 | ||||
| -rw-r--r-- | lisp/net/tramp-sudoedit.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 12 |
8 files changed, 130 insertions, 90 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 4512179eb14..aae25d1dbf3 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -1097,7 +1097,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 1097 | "Like `exec-path' for Tramp files." | 1097 | "Like `exec-path' for Tramp files." |
| 1098 | (append | 1098 | (append |
| 1099 | (with-parsed-tramp-file-name default-directory nil | 1099 | (with-parsed-tramp-file-name default-directory nil |
| 1100 | (with-tramp-connection-property v "remote-path" | 1100 | (with-tramp-connection-property (tramp-get-process v) "remote-path" |
| 1101 | (tramp-adb-send-command v "echo \\\"$PATH\\\"") | 1101 | (tramp-adb-send-command v "echo \\\"$PATH\\\"") |
| 1102 | (split-string | 1102 | (split-string |
| 1103 | (with-current-buffer (tramp-get-connection-buffer v) | 1103 | (with-current-buffer (tramp-get-connection-buffer v) |
| @@ -1112,11 +1112,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 1112 | "Return full host name from VEC to be used in shell execution. | 1112 | "Return full host name from VEC to be used in shell execution. |
| 1113 | E.g. a host name \"192.168.1.1#5555\" returns \"192.168.1.1:5555\" | 1113 | E.g. a host name \"192.168.1.1#5555\" returns \"192.168.1.1:5555\" |
| 1114 | a host name \"R38273882DE\" returns \"R38273882DE\"." | 1114 | a host name \"R38273882DE\" returns \"R38273882DE\"." |
| 1115 | ;; Sometimes this is called before there is a connection process | 1115 | (with-tramp-connection-property (tramp-get-process vec) "device" |
| 1116 | ;; yet. In order to work with the connection cache, we flush all | ||
| 1117 | ;; unwanted entries first. | ||
| 1118 | (tramp-flush-connection-properties nil) | ||
| 1119 | (with-tramp-connection-property (tramp-get-connection-process vec) "device" | ||
| 1120 | (let* ((host (tramp-file-name-host vec)) | 1116 | (let* ((host (tramp-file-name-host vec)) |
| 1121 | (port (tramp-file-name-port-or-default vec)) | 1117 | (port (tramp-file-name-port-or-default vec)) |
| 1122 | (devices (mapcar #'cadr (tramp-adb-parse-device-names nil)))) | 1118 | (devices (mapcar #'cadr (tramp-adb-parse-device-names nil)))) |
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 91ed5465695..93eeb16f547 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el | |||
| @@ -31,13 +31,13 @@ | |||
| 31 | ;; a process, has a unique cache. We distinguish 4 kind of caches, | 31 | ;; a process, has a unique cache. We distinguish 4 kind of caches, |
| 32 | ;; depending on the key: | 32 | ;; depending on the key: |
| 33 | ;; | 33 | ;; |
| 34 | ;; - localname is NIL. This are reusable properties. Examples: | 34 | ;; - localname is nil. These are reusable properties. Examples: |
| 35 | ;; "remote-shell" identifies the POSIX shell to be called on the | 35 | ;; "remote-shell" identifies the POSIX shell to be called on the |
| 36 | ;; remote host, or "perl" is the command to be called on the remote | 36 | ;; remote host, or "perl" is the command to be called on the remote |
| 37 | ;; host when starting a Perl script. These properties are saved in | 37 | ;; host when starting a Perl script. These properties are saved in |
| 38 | ;; the file `tramp-persistency-file-name'. | 38 | ;; the file `tramp-persistency-file-name'. |
| 39 | ;; | 39 | ;; |
| 40 | ;; - localname is a string. This are temporary properties, which are | 40 | ;; - localname is a string. These are temporary properties, which are |
| 41 | ;; related to the file localname is referring to. Examples: | 41 | ;; related to the file localname is referring to. Examples: |
| 42 | ;; "file-exists-p" is t or nil, depending on the file existence, or | 42 | ;; "file-exists-p" is t or nil, depending on the file existence, or |
| 43 | ;; "file-attributes" caches the result of the function | 43 | ;; "file-attributes" caches the result of the function |
| @@ -45,21 +45,32 @@ | |||
| 45 | ;; expire after `remote-file-name-inhibit-cache' seconds if this | 45 | ;; expire after `remote-file-name-inhibit-cache' seconds if this |
| 46 | ;; variable is set. | 46 | ;; variable is set. |
| 47 | ;; | 47 | ;; |
| 48 | ;; - The key is a process. This are temporary properties related to | 48 | ;; - The key is a process. These are temporary properties related to |
| 49 | ;; an open connection. Examples: "scripts" keeps shell script | 49 | ;; an open connection. Examples: "scripts" keeps shell script |
| 50 | ;; definitions already sent to the remote shell, "last-cmd-time" is | 50 | ;; definitions already sent to the remote shell, "last-cmd-time" is |
| 51 | ;; the time stamp a command has been sent to the remote process. | 51 | ;; the time stamp a command has been sent to the remote process. |
| 52 | ;; | 52 | ;; |
| 53 | ;; - The key is nil. This are temporary properties related to the | 53 | ;; - The key is nil. These are temporary properties related to the |
| 54 | ;; local machine. Examples: "parse-passwd" and "parse-group" keep | 54 | ;; local machine. Examples: "parse-passwd" and "parse-group" keep |
| 55 | ;; the results of parsing "/etc/passwd" and "/etc/group", | 55 | ;; the results of parsing "/etc/passwd" and "/etc/group", |
| 56 | ;; "{uid,gid}-{integer,string}" are the local uid and gid, and | 56 | ;; "{uid,gid}-{integer,string}" are the local uid and gid, and |
| 57 | ;; "locale" is the used shell locale. | 57 | ;; "locale" is the used shell locale. |
| 58 | ;; | ||
| 59 | ;; - The key is `tramp-cache-undefined'. All functions return the | ||
| 60 | ;; expected values, but nothing is cached. | ||
| 58 | 61 | ||
| 59 | ;; Some properties are handled special: | 62 | ;; Some properties are handled special: |
| 60 | ;; | 63 | ;; |
| 61 | ;; - "process-name", "process-buffer" and "first-password-request" are | 64 | ;; - "process-name", "process-buffer" and "first-password-request" are |
| 62 | ;; not saved in the file `tramp-persistency-file-name'. | 65 | ;; not saved in the file `tramp-persistency-file-name', although |
| 66 | ;; being connection properties related to a `tramp-file-name' | ||
| 67 | ;; structure. | ||
| 68 | ;; | ||
| 69 | ;; - Reusable properties, which should not be saved, are kept in the | ||
| 70 | ;; process key retrieved by `tramp-get-process' (the main connection | ||
| 71 | ;; process). Other processes could reuse these properties, avoiding | ||
| 72 | ;; recomputation when a new asynchronous process is created by | ||
| 73 | ;; `make-process'. Examples are "remote-path" or "device" (tramp-adb.el). | ||
| 63 | 74 | ||
| 64 | ;;; Code: | 75 | ;;; Code: |
| 65 | 76 | ||
| @@ -96,25 +107,31 @@ details see the info pages." | |||
| 96 | (defvar tramp-cache-data-changed nil | 107 | (defvar tramp-cache-data-changed nil |
| 97 | "Whether persistent cache data have been changed.") | 108 | "Whether persistent cache data have been changed.") |
| 98 | 109 | ||
| 110 | ;;;###tramp-autoload | ||
| 111 | (defconst tramp-cache-undefined 'undef | ||
| 112 | "The symbol marking undefined hash keys and values.") | ||
| 113 | |||
| 99 | (defun tramp-get-hash-table (key) | 114 | (defun tramp-get-hash-table (key) |
| 100 | "Return the hash table for KEY. | 115 | "Return the hash table for KEY. |
| 101 | If it doesn't exist yet, it is created and initialized with | 116 | If it doesn't exist yet, it is created and initialized with |
| 102 | matching entries of `tramp-connection-properties'." | 117 | matching entries of `tramp-connection-properties'. |
| 103 | (or (gethash key tramp-cache-data) | 118 | If KEY is `tramp-cache-undefined', don't create anything, and return nil." |
| 104 | (let ((hash | 119 | (unless (eq key tramp-cache-undefined) |
| 105 | (puthash key (make-hash-table :test #'equal) tramp-cache-data))) | 120 | (or (gethash key tramp-cache-data) |
| 106 | (when (tramp-file-name-p key) | 121 | (let ((hash |
| 107 | (dolist (elt tramp-connection-properties) | 122 | (puthash key (make-hash-table :test #'equal) tramp-cache-data))) |
| 108 | (when (string-match-p | 123 | (when (tramp-file-name-p key) |
| 109 | (or (nth 0 elt) "") | 124 | (dolist (elt tramp-connection-properties) |
| 110 | (tramp-make-tramp-file-name key 'noloc 'nohop)) | 125 | (when (string-match-p |
| 111 | (tramp-set-connection-property key (nth 1 elt) (nth 2 elt))))) | 126 | (or (nth 0 elt) "") |
| 112 | hash))) | 127 | (tramp-make-tramp-file-name key 'noloc 'nohop)) |
| 128 | (tramp-set-connection-property key (nth 1 elt) (nth 2 elt))))) | ||
| 129 | hash)))) | ||
| 113 | 130 | ||
| 114 | ;;;###tramp-autoload | 131 | ;;;###tramp-autoload |
| 115 | (defun tramp-get-file-property (key file property default) | 132 | (defun tramp-get-file-property (key file property default) |
| 116 | "Get the PROPERTY of FILE from the cache context of KEY. | 133 | "Get the PROPERTY of FILE from the cache context of KEY. |
| 117 | Returns DEFAULT if not set." | 134 | Return DEFAULT if not set." |
| 118 | ;; Unify localname. Remove hop from `tramp-file-name' structure. | 135 | ;; Unify localname. Remove hop from `tramp-file-name' structure. |
| 119 | (setq file (tramp-compat-file-name-unquote file) | 136 | (setq file (tramp-compat-file-name-unquote file) |
| 120 | key (copy-tramp-file-name key)) | 137 | key (copy-tramp-file-name key)) |
| @@ -152,7 +169,7 @@ Returns DEFAULT if not set." | |||
| 152 | ;;;###tramp-autoload | 169 | ;;;###tramp-autoload |
| 153 | (defun tramp-set-file-property (key file property value) | 170 | (defun tramp-set-file-property (key file property value) |
| 154 | "Set the PROPERTY of FILE to VALUE, in the cache context of KEY. | 171 | "Set the PROPERTY of FILE to VALUE, in the cache context of KEY. |
| 155 | Returns VALUE." | 172 | Return VALUE." |
| 156 | ;; Unify localname. Remove hop from `tramp-file-name' structure. | 173 | ;; Unify localname. Remove hop from `tramp-file-name' structure. |
| 157 | (setq file (tramp-compat-file-name-unquote file) | 174 | (setq file (tramp-compat-file-name-unquote file) |
| 158 | key (copy-tramp-file-name key)) | 175 | key (copy-tramp-file-name key)) |
| @@ -283,8 +300,9 @@ This is suppressed for temporary buffers." | |||
| 283 | "Get the named PROPERTY for the connection. | 300 | "Get the named PROPERTY for the connection. |
| 284 | KEY identifies the connection, it is either a process or a | 301 | KEY identifies the connection, it is either a process or a |
| 285 | `tramp-file-name' structure. A special case is nil, which is | 302 | `tramp-file-name' structure. A special case is nil, which is |
| 286 | used to cache connection properties of the local machine. If the | 303 | used to cache connection properties of the local machine. |
| 287 | value is not set for the connection, returns DEFAULT." | 304 | If KEY is `tramp-cache-undefined', or if the value is not set for |
| 305 | the connection, return DEFAULT." | ||
| 288 | ;; Unify key by removing localname and hop from `tramp-file-name' | 306 | ;; Unify key by removing localname and hop from `tramp-file-name' |
| 289 | ;; structure. Work with a copy in order to avoid side effects. | 307 | ;; structure. Work with a copy in order to avoid side effects. |
| 290 | (when (tramp-file-name-p key) | 308 | (when (tramp-file-name-p key) |
| @@ -308,19 +326,22 @@ value is not set for the connection, returns DEFAULT." | |||
| 308 | "Set the named PROPERTY of a connection to VALUE. | 326 | "Set the named PROPERTY of a connection to VALUE. |
| 309 | KEY identifies the connection, it is either a process or a | 327 | KEY identifies the connection, it is either a process or a |
| 310 | `tramp-file-name' structure. A special case is nil, which is | 328 | `tramp-file-name' structure. A special case is nil, which is |
| 311 | used to cache connection properties of the local machine. | 329 | used to cache connection properties of the local machine. If KEY |
| 312 | PROPERTY is set persistent when KEY is a `tramp-file-name' structure." | 330 | is `tramp-cache-undefined', nothing is set. |
| 331 | PROPERTY is set persistent when KEY is a `tramp-file-name' structure. | ||
| 332 | Return VALUE." | ||
| 313 | ;; Unify key by removing localname and hop from `tramp-file-name' | 333 | ;; Unify key by removing localname and hop from `tramp-file-name' |
| 314 | ;; structure. Work with a copy in order to avoid side effects. | 334 | ;; structure. Work with a copy in order to avoid side effects. |
| 315 | (when (tramp-file-name-p key) | 335 | (when (tramp-file-name-p key) |
| 316 | (setq key (copy-tramp-file-name key)) | 336 | (setq key (copy-tramp-file-name key)) |
| 317 | (setf (tramp-file-name-localname key) nil | 337 | (setf (tramp-file-name-localname key) nil |
| 318 | (tramp-file-name-hop key) nil)) | 338 | (tramp-file-name-hop key) nil)) |
| 319 | (let ((hash (tramp-get-hash-table key))) | 339 | (when-let ((hash (tramp-get-hash-table key))) |
| 320 | (puthash property value hash) | 340 | (puthash property value hash)) |
| 321 | (setq tramp-cache-data-changed t) | 341 | (setq tramp-cache-data-changed |
| 322 | (tramp-message key 7 "%s %s" property value) | 342 | (or tramp-cache-data-changed (tramp-tramp-file-p key))) |
| 323 | value)) | 343 | (tramp-message key 7 "%s %s" property value) |
| 344 | value) | ||
| 324 | 345 | ||
| 325 | ;;;###tramp-autoload | 346 | ;;;###tramp-autoload |
| 326 | (defun tramp-connection-property-p (key property) | 347 | (defun tramp-connection-property-p (key property) |
| @@ -328,7 +349,8 @@ PROPERTY is set persistent when KEY is a `tramp-file-name' structure." | |||
| 328 | KEY identifies the connection, it is either a process or a | 349 | KEY identifies the connection, it is either a process or a |
| 329 | `tramp-file-name' structure. A special case is nil, which is | 350 | `tramp-file-name' structure. A special case is nil, which is |
| 330 | used to cache connection properties of the local machine." | 351 | used to cache connection properties of the local machine." |
| 331 | (not (eq (tramp-get-connection-property key property 'undef) 'undef))) | 352 | (not (eq (tramp-get-connection-property key property tramp-cache-undefined) |
| 353 | tramp-cache-undefined))) | ||
| 332 | 354 | ||
| 333 | ;;;###tramp-autoload | 355 | ;;;###tramp-autoload |
| 334 | (defun tramp-flush-connection-property (key property) | 356 | (defun tramp-flush-connection-property (key property) |
| @@ -343,8 +365,10 @@ PROPERTY is set persistent when KEY is a `tramp-file-name' structure." | |||
| 343 | (setq key (copy-tramp-file-name key)) | 365 | (setq key (copy-tramp-file-name key)) |
| 344 | (setf (tramp-file-name-localname key) nil | 366 | (setf (tramp-file-name-localname key) nil |
| 345 | (tramp-file-name-hop key) nil)) | 367 | (tramp-file-name-hop key) nil)) |
| 346 | (remhash property (tramp-get-hash-table key)) | 368 | (when-let ((hash (tramp-get-hash-table key))) |
| 347 | (setq tramp-cache-data-changed t) | 369 | (remhash property hash)) |
| 370 | (setq tramp-cache-data-changed | ||
| 371 | (or tramp-cache-data-changed (tramp-tramp-file-p key))) | ||
| 348 | (tramp-message key 7 "%s" property)) | 372 | (tramp-message key 7 "%s" property)) |
| 349 | 373 | ||
| 350 | ;;;###tramp-autoload | 374 | ;;;###tramp-autoload |
| @@ -361,9 +385,10 @@ used to cache connection properties of the local machine." | |||
| 361 | (tramp-file-name-hop key) nil)) | 385 | (tramp-file-name-hop key) nil)) |
| 362 | (tramp-message | 386 | (tramp-message |
| 363 | key 7 "%s %s" key | 387 | key 7 "%s %s" key |
| 364 | (let ((hash (gethash key tramp-cache-data))) | 388 | (when-let ((hash (gethash key tramp-cache-data))) |
| 365 | (when (hash-table-p hash) (hash-table-keys hash)))) | 389 | (hash-table-keys hash))) |
| 366 | (setq tramp-cache-data-changed t) | 390 | (setq tramp-cache-data-changed |
| 391 | (or tramp-cache-data-changed (tramp-tramp-file-p key))) | ||
| 367 | (remhash key tramp-cache-data)) | 392 | (remhash key tramp-cache-data)) |
| 368 | 393 | ||
| 369 | ;;;###tramp-autoload | 394 | ;;;###tramp-autoload |
| @@ -414,7 +439,8 @@ used to cache connection properties of the local machine." | |||
| 414 | (hash-table-keys tramp-cache-data))))) | 439 | (hash-table-keys tramp-cache-data))))) |
| 415 | 440 | ||
| 416 | (defun tramp-dump-connection-properties () | 441 | (defun tramp-dump-connection-properties () |
| 417 | "Write persistent connection properties into file `tramp-persistency-file-name'." | 442 | "Write persistent connection properties into file \ |
| 443 | `tramp-persistency-file-name'." | ||
| 418 | ;; We shouldn't fail, otherwise Emacs might not be able to be closed. | 444 | ;; We shouldn't fail, otherwise Emacs might not be able to be closed. |
| 419 | (ignore-errors | 445 | (ignore-errors |
| 420 | (when (and (hash-table-p tramp-cache-data) | 446 | (when (and (hash-table-p tramp-cache-data) |
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index b4dca2321c1..7d353e262af 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el | |||
| @@ -107,21 +107,19 @@ When called interactively, a Tramp connection has to be selected." | |||
| 107 | ;; suppressed. | 107 | ;; suppressed. |
| 108 | (setq tramp-current-connection nil) | 108 | (setq tramp-current-connection nil) |
| 109 | 109 | ||
| 110 | ;; Flush file cache. | ||
| 111 | (tramp-flush-directory-properties vec "") | ||
| 112 | |||
| 113 | ;; Flush connection cache. | ||
| 114 | (when (processp (tramp-get-connection-process vec)) | ||
| 115 | (tramp-flush-connection-properties (tramp-get-connection-process vec)) | ||
| 116 | (delete-process (tramp-get-connection-process vec))) | ||
| 117 | (tramp-flush-connection-properties vec) | ||
| 118 | |||
| 119 | ;; Cancel timer. | 110 | ;; Cancel timer. |
| 120 | (dolist (timer timer-list) | 111 | (dolist (timer timer-list) |
| 121 | (when (and (eq (timer--function timer) 'tramp-timeout-session) | 112 | (when (and (eq (timer--function timer) 'tramp-timeout-session) |
| 122 | (tramp-file-name-equal-p vec (car (timer--args timer)))) | 113 | (tramp-file-name-equal-p vec (car (timer--args timer)))) |
| 123 | (cancel-timer timer))) | 114 | (cancel-timer timer))) |
| 124 | 115 | ||
| 116 | ;; Delete processes. | ||
| 117 | (dolist (key (hash-table-keys tramp-cache-data)) | ||
| 118 | (when (and (processp key) | ||
| 119 | (tramp-file-name-equal-p (process-get key 'vector) vec)) | ||
| 120 | (tramp-flush-connection-properties key) | ||
| 121 | (delete-process key))) | ||
| 122 | |||
| 125 | ;; Remove buffers. | 123 | ;; Remove buffers. |
| 126 | (dolist | 124 | (dolist |
| 127 | (buf (list (get-buffer (tramp-buffer-name vec)) | 125 | (buf (list (get-buffer (tramp-buffer-name vec)) |
| @@ -130,6 +128,12 @@ When called interactively, a Tramp connection has to be selected." | |||
| 130 | (tramp-get-connection-property vec "process-buffer" nil))) | 128 | (tramp-get-connection-property vec "process-buffer" nil))) |
| 131 | (when (bufferp buf) (kill-buffer buf))) | 129 | (when (bufferp buf) (kill-buffer buf))) |
| 132 | 130 | ||
| 131 | ;; Flush file cache. | ||
| 132 | (tramp-flush-directory-properties vec "") | ||
| 133 | |||
| 134 | ;; Flush connection cache. | ||
| 135 | (tramp-flush-connection-properties vec) | ||
| 136 | |||
| 133 | ;; The end. | 137 | ;; The end. |
| 134 | (run-hook-with-args 'tramp-cleanup-connection-hook vec))) | 138 | (run-hook-with-args 'tramp-cleanup-connection-hook vec))) |
| 135 | 139 | ||
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 85f28076168..526c564ee33 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -1731,8 +1731,7 @@ a downcased host name only." | |||
| 1731 | (list | 1731 | (list |
| 1732 | t ;; handled. | 1732 | t ;; handled. |
| 1733 | nil ;; no abort of D-Bus. | 1733 | nil ;; no abort of D-Bus. |
| 1734 | (with-tramp-connection-property | 1734 | (with-tramp-connection-property (tramp-get-process v) message |
| 1735 | (tramp-get-connection-process v) message | ||
| 1736 | ;; In theory, there can be several choices. | 1735 | ;; In theory, there can be several choices. |
| 1737 | ;; Until now, there is only the question whether | 1736 | ;; Until now, there is only the question whether |
| 1738 | ;; to accept an unknown host signature or certificate. | 1737 | ;; to accept an unknown host signature or certificate. |
| @@ -1946,8 +1945,7 @@ a downcased host name only." | |||
| 1946 | (tramp-gvfs-url-file-name (tramp-make-tramp-file-name vec)))) | 1945 | (tramp-gvfs-url-file-name (tramp-make-tramp-file-name vec)))) |
| 1947 | (while (tramp-gvfs-connection-mounted-p vec) | 1946 | (while (tramp-gvfs-connection-mounted-p vec) |
| 1948 | (read-event nil nil 0.1)) | 1947 | (read-event nil nil 0.1)) |
| 1949 | (tramp-flush-connection-properties vec) | 1948 | (tramp-cleanup-connection vec 'keep-debug 'keep-password)) |
| 1950 | (tramp-flush-connection-properties (tramp-get-connection-process vec))) | ||
| 1951 | 1949 | ||
| 1952 | (defun tramp-gvfs-mount-spec-entry (key value) | 1950 | (defun tramp-gvfs-mount-spec-entry (key value) |
| 1953 | "Construct a mount-spec entry to be used in a mount_spec. | 1951 | "Construct a mount-spec entry to be used in a mount_spec. |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 06dca312275..c770e3ce400 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -1539,7 +1539,7 @@ of." | |||
| 1539 | 1539 | ||
| 1540 | (defun tramp-remote-selinux-p (vec) | 1540 | (defun tramp-remote-selinux-p (vec) |
| 1541 | "Check, whether SELINUX is enabled on the remote host." | 1541 | "Check, whether SELINUX is enabled on the remote host." |
| 1542 | (with-tramp-connection-property (tramp-get-connection-process vec) "selinux-p" | 1542 | (with-tramp-connection-property (tramp-get-process vec) "selinux-p" |
| 1543 | (tramp-send-command-and-check vec "selinuxenabled"))) | 1543 | (tramp-send-command-and-check vec "selinuxenabled"))) |
| 1544 | 1544 | ||
| 1545 | (defun tramp-sh-handle-file-selinux-context (filename) | 1545 | (defun tramp-sh-handle-file-selinux-context (filename) |
| @@ -1588,7 +1588,7 @@ of." | |||
| 1588 | 1588 | ||
| 1589 | (defun tramp-remote-acl-p (vec) | 1589 | (defun tramp-remote-acl-p (vec) |
| 1590 | "Check, whether ACL is enabled on the remote host." | 1590 | "Check, whether ACL is enabled on the remote host." |
| 1591 | (with-tramp-connection-property (tramp-get-connection-process vec) "acl-p" | 1591 | (with-tramp-connection-property (tramp-get-process vec) "acl-p" |
| 1592 | (tramp-send-command-and-check vec "getfacl /"))) | 1592 | (tramp-send-command-and-check vec "getfacl /"))) |
| 1593 | 1593 | ||
| 1594 | (defun tramp-sh-handle-file-acl (filename) | 1594 | (defun tramp-sh-handle-file-acl (filename) |
| @@ -3580,23 +3580,29 @@ STDERR can also be a file name." | |||
| 3580 | remote-file-name-inhibit-cache process-file-side-effects) | 3580 | remote-file-name-inhibit-cache process-file-side-effects) |
| 3581 | ;; Reduce `vc-handled-backends' in order to minimize | 3581 | ;; Reduce `vc-handled-backends' in order to minimize |
| 3582 | ;; process calls. | 3582 | ;; process calls. |
| 3583 | (when (and (memq 'Bzr vc-handled-backends) | 3583 | (when (and |
| 3584 | (boundp 'vc-bzr-program) | 3584 | (memq 'Bzr vc-handled-backends) |
| 3585 | (not (with-tramp-connection-property v vc-bzr-program | 3585 | (not (and |
| 3586 | (tramp-find-executable | 3586 | (bound-and-true-p vc-bzr-program) |
| 3587 | v vc-bzr-program (tramp-get-remote-path v))))) | 3587 | (with-tramp-connection-property v vc-bzr-program |
| 3588 | (tramp-find-executable | ||
| 3589 | v vc-bzr-program (tramp-get-remote-path v)))))) | ||
| 3588 | (setq vc-handled-backends (remq 'Bzr vc-handled-backends))) | 3590 | (setq vc-handled-backends (remq 'Bzr vc-handled-backends))) |
| 3589 | (when (and (memq 'Git vc-handled-backends) | 3591 | (when (and |
| 3590 | (boundp 'vc-git-program) | 3592 | (memq 'Git vc-handled-backends) |
| 3591 | (not (with-tramp-connection-property v vc-git-program | 3593 | (not (and |
| 3592 | (tramp-find-executable | 3594 | (bound-and-true-p vc-git-program) |
| 3593 | v vc-git-program (tramp-get-remote-path v))))) | 3595 | (with-tramp-connection-property v vc-git-program |
| 3596 | (tramp-find-executable | ||
| 3597 | v vc-git-program (tramp-get-remote-path v)))))) | ||
| 3594 | (setq vc-handled-backends (remq 'Git vc-handled-backends))) | 3598 | (setq vc-handled-backends (remq 'Git vc-handled-backends))) |
| 3595 | (when (and (memq 'Hg vc-handled-backends) | 3599 | (when (and |
| 3596 | (boundp 'vc-hg-program) | 3600 | (memq 'Hg vc-handled-backends) |
| 3597 | (not (with-tramp-connection-property v vc-hg-program | 3601 | (not (and |
| 3598 | (tramp-find-executable | 3602 | (bound-and-true-p vc-hg-program) |
| 3599 | v vc-hg-program (tramp-get-remote-path v))))) | 3603 | (with-tramp-connection-property v vc-hg-program |
| 3604 | (tramp-find-executable | ||
| 3605 | v vc-hg-program (tramp-get-remote-path v)))))) | ||
| 3600 | (setq vc-handled-backends (remq 'Hg vc-handled-backends))) | 3606 | (setq vc-handled-backends (remq 'Hg vc-handled-backends))) |
| 3601 | ;; Run. | 3607 | ;; Run. |
| 3602 | (tramp-with-demoted-errors | 3608 | (tramp-with-demoted-errors |
| @@ -4290,11 +4296,15 @@ process to set up. VEC specifies the connection." | |||
| 4290 | ;; connection properties. We start again with | 4296 | ;; connection properties. We start again with |
| 4291 | ;; `tramp-maybe-open-connection', it will be caught there. | 4297 | ;; `tramp-maybe-open-connection', it will be caught there. |
| 4292 | (tramp-message vec 5 "Checking system information") | 4298 | (tramp-message vec 5 "Checking system information") |
| 4293 | (let ((old-uname (tramp-get-connection-property vec "uname" nil)) | 4299 | (let* ((old-uname (tramp-get-connection-property vec "uname" nil)) |
| 4294 | (uname | 4300 | (uname |
| 4295 | (tramp-set-connection-property | 4301 | ;; If we are in `make-process', we don't need to recompute. |
| 4296 | vec "uname" | 4302 | (if (and old-uname |
| 4297 | (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))) | 4303 | (tramp-get-connection-property vec "process-name" nil)) |
| 4304 | old-uname | ||
| 4305 | (tramp-set-connection-property | ||
| 4306 | vec "uname" | ||
| 4307 | (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\""))))) | ||
| 4298 | (when (and (stringp old-uname) (not (string-equal old-uname uname))) | 4308 | (when (and (stringp old-uname) (not (string-equal old-uname uname))) |
| 4299 | (tramp-message | 4309 | (tramp-message |
| 4300 | vec 3 | 4310 | vec 3 |
| @@ -5053,7 +5063,7 @@ connection if a previous connection has died for some reason." | |||
| 5053 | ;; we cannot use `tramp-get-connection-process'. | 5063 | ;; we cannot use `tramp-get-connection-process'. |
| 5054 | (tmpfile | 5064 | (tmpfile |
| 5055 | (with-tramp-connection-property | 5065 | (with-tramp-connection-property |
| 5056 | (get-process (tramp-buffer-name vec)) "temp-file" | 5066 | (tramp-get-process vec) "temp-file" |
| 5057 | (make-temp-name | 5067 | (make-temp-name |
| 5058 | (expand-file-name | 5068 | (expand-file-name |
| 5059 | tramp-temp-name-prefix | 5069 | tramp-temp-name-prefix |
| @@ -5426,7 +5436,7 @@ Nonexistent directories are removed from spec." | |||
| 5426 | ;; cache the result for the session only. Otherwise, the | 5436 | ;; cache the result for the session only. Otherwise, the |
| 5427 | ;; result is cached persistently. | 5437 | ;; result is cached persistently. |
| 5428 | (if (memq 'tramp-own-remote-path tramp-remote-path) | 5438 | (if (memq 'tramp-own-remote-path tramp-remote-path) |
| 5429 | (tramp-get-connection-process vec) | 5439 | (tramp-get-process vec) |
| 5430 | vec) | 5440 | vec) |
| 5431 | "remote-path" | 5441 | "remote-path" |
| 5432 | (let* ((remote-path (copy-tree tramp-remote-path)) | 5442 | (let* ((remote-path (copy-tree tramp-remote-path)) |
| @@ -5945,10 +5955,9 @@ the length of the file to be compressed. | |||
| 5945 | If no corresponding command is found, nil is returned." | 5955 | If no corresponding command is found, nil is returned." |
| 5946 | (when (and (integerp tramp-inline-compress-start-size) | 5956 | (when (and (integerp tramp-inline-compress-start-size) |
| 5947 | (> size tramp-inline-compress-start-size)) | 5957 | (> size tramp-inline-compress-start-size)) |
| 5948 | (with-tramp-connection-property (tramp-get-connection-process vec) prop | 5958 | (with-tramp-connection-property (tramp-get-process vec) prop |
| 5949 | (tramp-find-inline-compress vec) | 5959 | (tramp-find-inline-compress vec) |
| 5950 | (tramp-get-connection-property | 5960 | (tramp-get-connection-property (tramp-get-process vec) prop nil)))) |
| 5951 | (tramp-get-connection-process vec) prop nil)))) | ||
| 5952 | 5961 | ||
| 5953 | (defun tramp-get-inline-coding (vec prop size) | 5962 | (defun tramp-get-inline-coding (vec prop size) |
| 5954 | "Return the coding command related to PROP. | 5963 | "Return the coding command related to PROP. |
| @@ -5966,11 +5975,9 @@ function cell is returned to be applied on a buffer." | |||
| 5966 | ;; no inline coding is found. | 5975 | ;; no inline coding is found. |
| 5967 | (ignore-errors | 5976 | (ignore-errors |
| 5968 | (let ((coding | 5977 | (let ((coding |
| 5969 | (with-tramp-connection-property | 5978 | (with-tramp-connection-property (tramp-get-process vec) prop |
| 5970 | (tramp-get-connection-process vec) prop | ||
| 5971 | (tramp-find-inline-encoding vec) | 5979 | (tramp-find-inline-encoding vec) |
| 5972 | (tramp-get-connection-property | 5980 | (tramp-get-connection-property (tramp-get-process vec) prop nil))) |
| 5973 | (tramp-get-connection-process vec) prop nil))) | ||
| 5974 | (prop1 (if (string-match-p "encoding" prop) | 5981 | (prop1 (if (string-match-p "encoding" prop) |
| 5975 | "inline-compress" "inline-decompress")) | 5982 | "inline-compress" "inline-decompress")) |
| 5976 | compress) | 5983 | compress) |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 100ddfaa681..d361db483a1 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -1845,7 +1845,7 @@ are listed. Result is the list (LOCALNAME MODE SIZE MTIME)." | |||
| 1845 | (if (and (process-live-p (tramp-get-connection-process vec)) | 1845 | (if (and (process-live-p (tramp-get-connection-process vec)) |
| 1846 | (tramp-get-connection-property vec "posix" t)) | 1846 | (tramp-get-connection-property vec "posix" t)) |
| 1847 | (with-tramp-connection-property | 1847 | (with-tramp-connection-property |
| 1848 | (tramp-get-connection-process vec) "cifs-capabilities" | 1848 | (tramp-get-process vec) "cifs-capabilities" |
| 1849 | (save-match-data | 1849 | (save-match-data |
| 1850 | (when (tramp-smb-send-command vec "posix") | 1850 | (when (tramp-smb-send-command vec "posix") |
| 1851 | (with-current-buffer (tramp-get-connection-buffer vec) | 1851 | (with-current-buffer (tramp-get-connection-buffer vec) |
| @@ -1862,8 +1862,7 @@ are listed. Result is the list (LOCALNAME MODE SIZE MTIME)." | |||
| 1862 | ;; When we are not logged in yet, we return nil. | 1862 | ;; When we are not logged in yet, we return nil. |
| 1863 | (if (and (tramp-smb-get-share vec) | 1863 | (if (and (tramp-smb-get-share vec) |
| 1864 | (process-live-p (tramp-get-connection-process vec))) | 1864 | (process-live-p (tramp-get-connection-process vec))) |
| 1865 | (with-tramp-connection-property | 1865 | (with-tramp-connection-property (tramp-get-process vec) "stat-capability" |
| 1866 | (tramp-get-connection-process vec) "stat-capability" | ||
| 1867 | (tramp-smb-send-command vec "stat \"/\"")))) | 1866 | (tramp-smb-send-command vec "stat \"/\"")))) |
| 1868 | 1867 | ||
| 1869 | 1868 | ||
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el index b6861ba7882..68e68a242c9 100644 --- a/lisp/net/tramp-sudoedit.el +++ b/lisp/net/tramp-sudoedit.el | |||
| @@ -373,7 +373,7 @@ the result will be a local, non-Tramp, file name." | |||
| 373 | 373 | ||
| 374 | (defun tramp-sudoedit-remote-acl-p (vec) | 374 | (defun tramp-sudoedit-remote-acl-p (vec) |
| 375 | "Check, whether ACL is enabled on the remote host." | 375 | "Check, whether ACL is enabled on the remote host." |
| 376 | (with-tramp-connection-property (tramp-get-connection-process vec) "acl-p" | 376 | (with-tramp-connection-property (tramp-get-process vec) "acl-p" |
| 377 | (zerop (tramp-call-process vec "getfacl" nil nil nil "/")))) | 377 | (zerop (tramp-call-process vec "getfacl" nil nil nil "/")))) |
| 378 | 378 | ||
| 379 | (defun tramp-sudoedit-handle-file-acl (filename) | 379 | (defun tramp-sudoedit-handle-file-acl (filename) |
| @@ -478,7 +478,7 @@ the result will be a local, non-Tramp, file name." | |||
| 478 | 478 | ||
| 479 | (defun tramp-sudoedit-remote-selinux-p (vec) | 479 | (defun tramp-sudoedit-remote-selinux-p (vec) |
| 480 | "Check, whether SELINUX is enabled on the remote host." | 480 | "Check, whether SELINUX is enabled on the remote host." |
| 481 | (with-tramp-connection-property (tramp-get-connection-process vec) "selinux-p" | 481 | (with-tramp-connection-property (tramp-get-process vec) "selinux-p" |
| 482 | (zerop (tramp-call-process vec "selinuxenabled")))) | 482 | (zerop (tramp-call-process vec "selinuxenabled")))) |
| 483 | 483 | ||
| 484 | (defun tramp-sudoedit-handle-file-selinux-context (filename) | 484 | (defun tramp-sudoedit-handle-file-selinux-context (filename) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 3ce2225cb84..e30f27fd338 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -37,7 +37,7 @@ | |||
| 37 | ;; For more detailed instructions, please see the info file. | 37 | ;; For more detailed instructions, please see the info file. |
| 38 | ;; | 38 | ;; |
| 39 | ;; Notes: | 39 | ;; Notes: |
| 40 | ;; ----- | 40 | ;; ------ |
| 41 | ;; | 41 | ;; |
| 42 | ;; Also see the todo list at the bottom of this file. | 42 | ;; Also see the todo list at the bottom of this file. |
| 43 | ;; | 43 | ;; |
| @@ -46,6 +46,7 @@ | |||
| 46 | ;; | 46 | ;; |
| 47 | ;; There's a mailing list for this, as well. Its name is: | 47 | ;; There's a mailing list for this, as well. Its name is: |
| 48 | ;; tramp-devel@gnu.org | 48 | ;; tramp-devel@gnu.org |
| 49 | |||
| 49 | ;; You can use the Web to subscribe, under the following URL: | 50 | ;; You can use the Web to subscribe, under the following URL: |
| 50 | ;; https://lists.gnu.org/mailman/listinfo/tramp-devel | 51 | ;; https://lists.gnu.org/mailman/listinfo/tramp-devel |
| 51 | ;; | 52 | ;; |
| @@ -1631,6 +1632,15 @@ from the default one." | |||
| 1631 | (or (tramp-get-connection-property vec "process-name" nil) | 1632 | (or (tramp-get-connection-property vec "process-name" nil) |
| 1632 | (tramp-buffer-name vec))) | 1633 | (tramp-buffer-name vec))) |
| 1633 | 1634 | ||
| 1635 | (defun tramp-get-process (vec-or-proc) | ||
| 1636 | "Get the default connection process to be used for VEC-OR-PROC. | ||
| 1637 | Return `tramp-cache-undefined' in case it doesn't exist." | ||
| 1638 | (or (and (tramp-file-name-p vec-or-proc) | ||
| 1639 | (get-buffer-process (tramp-buffer-name vec-or-proc))) | ||
| 1640 | (and (processp vec-or-proc) | ||
| 1641 | (tramp-get-process (process-get vec-or-proc 'vector))) | ||
| 1642 | tramp-cache-undefined)) | ||
| 1643 | |||
| 1634 | (defun tramp-get-connection-process (vec) | 1644 | (defun tramp-get-connection-process (vec) |
| 1635 | "Get the connection process to be used for VEC. | 1645 | "Get the connection process to be used for VEC. |
| 1636 | In case a second asynchronous communication has been started, it is different | 1646 | In case a second asynchronous communication has been started, it is different |