From 9b9c70b7dbaa001d2f78a15fd1f3aaa8fce44eef Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 28 Nov 2018 16:38:49 +0100 Subject: [PATCH] Tramp cleanup * lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions) * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions): * lisp/net/tramp-smb.el (tramp-smb-read-file-entry): Use `string-match-p'. * lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection): Set file properties more robust. * lisp/net/tramp-sh.el (tramp-stat-marker) (tramp-convert-file-attributes): Add tramp-autoload cookie. --- lisp/net/tramp-cache.el | 12 +++++++++++- lisp/net/tramp-gvfs.el | 2 +- lisp/net/tramp-rclone.el | 17 ++++++++--------- lisp/net/tramp-sh.el | 4 +++- lisp/net/tramp-smb.el | 6 +++--- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index ebb4254dab4..51a8f13c4a4 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -28,7 +28,7 @@ ;; An implementation of information caching for remote files. ;; Each connection, identified by a `tramp-file-name' structure or by -;; a process, has a unique cache. We distinguish 3 kind of caches, +;; a process, has a unique cache. We distinguish 4 kind of caches, ;; depending on the key: ;; ;; - localname is NIL. This are reusable properties. Examples: @@ -49,6 +49,16 @@ ;; an open connection. Examples: "scripts" keeps shell script ;; definitions already sent to the remote shell, "last-cmd-time" is ;; the time stamp a command has been sent to the remote process. +;; +;; - The key is `nil'. This are temporary properties related to the +;; local machine. Examples: "parse-passwd" and "parse-group" keep +;; the results of parsing "/etc/passwd" and "/etc/group", "locale" +;; is the used shell locale. + +;; Some properties are handled special: +;; +;; - "process-name", "process-buffer" and "first-password-request" are +;; not saved in the file `tramp-persistency-file-name'. ;;; Code: diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 9d53edd0843..76747f7c993 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1143,7 +1143,7 @@ If FILE-SYSTEM is non-nil, return file system attributes." (defun tramp-gvfs-handle-file-name-all-completions (filename directory) "Like `file-name-all-completions' for Tramp files." - (unless (save-match-data (string-match "/" filename)) + (unless (string-match-p "/" filename) (all-completions filename (with-parsed-tramp-file-name (expand-file-name directory) nil diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 3ca857dc3be..6c01d7def1a 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -518,15 +518,14 @@ connection if a previous connection has died for some reason." ;; In `tramp-check-cached-permissions', the connection properties ;; {uig,gid}-{integer,string} are used. We set them to proper values. - (unless (tramp-get-connection-property vec "uid-integer" nil) - (tramp-set-connection-property - vec "uid-integer" (tramp-get-local-uid 'integer)) - (tramp-set-connection-property - vec "gid-integer" (tramp-get-local-gid 'integer)) - (tramp-set-connection-property - vec "uid-string" (tramp-get-local-uid 'string)) - (tramp-set-connection-property - vec "gid-string" (tramp-get-local-gid 'string)))) + (with-tramp-connection-property + vec "uid-integer" (tramp-get-local-uid 'integer)) + (with-tramp-connection-property + vec "gid-integer" (tramp-get-local-gid 'integer)) + (with-tramp-connection-property + vec "uid-string" (tramp-get-local-uid 'string)) + (with-tramp-connection-property + vec "gid-string" (tramp-get-local-gid 'string))) (defun tramp-rclone-send-command (vec &rest args) "Send the COMMAND to connection VEC." diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index b5d4893580e..900b4b3c277 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -945,6 +945,7 @@ od -v -t x1 -A n