Commit 9b9c70b7 authored by Michael Albinus's avatar Michael Albinus
Browse files

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.
parent 1ca436a3
Pipeline #165 failed with stage
in 28 minutes and 3 seconds
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
;; An implementation of information caching for remote files. ;; An implementation of information caching for remote files.
;; Each connection, identified by a `tramp-file-name' structure or by ;; 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: ;; depending on the key:
;; ;;
;; - localname is NIL. This are reusable properties. Examples: ;; - localname is NIL. This are reusable properties. Examples:
...@@ -49,6 +49,16 @@ ...@@ -49,6 +49,16 @@
;; an open connection. Examples: "scripts" keeps shell script ;; an open connection. Examples: "scripts" keeps shell script
;; definitions already sent to the remote shell, "last-cmd-time" is ;; definitions already sent to the remote shell, "last-cmd-time" is
;; the time stamp a command has been sent to the remote process. ;; 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: ;;; Code:
......
...@@ -1143,7 +1143,7 @@ If FILE-SYSTEM is non-nil, return file system attributes." ...@@ -1143,7 +1143,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
(defun tramp-gvfs-handle-file-name-all-completions (filename directory) (defun tramp-gvfs-handle-file-name-all-completions (filename directory)
"Like `file-name-all-completions' for Tramp files." "Like `file-name-all-completions' for Tramp files."
(unless (save-match-data (string-match "/" filename)) (unless (string-match-p "/" filename)
(all-completions (all-completions
filename filename
(with-parsed-tramp-file-name (expand-file-name directory) nil (with-parsed-tramp-file-name (expand-file-name directory) nil
......
...@@ -518,15 +518,14 @@ connection if a previous connection has died for some reason." ...@@ -518,15 +518,14 @@ connection if a previous connection has died for some reason."
;; In `tramp-check-cached-permissions', the connection properties ;; In `tramp-check-cached-permissions', the connection properties
;; {uig,gid}-{integer,string} are used. We set them to proper values. ;; {uig,gid}-{integer,string} are used. We set them to proper values.
(unless (tramp-get-connection-property vec "uid-integer" nil) (with-tramp-connection-property
(tramp-set-connection-property vec "uid-integer" (tramp-get-local-uid 'integer))
vec "uid-integer" (tramp-get-local-uid 'integer)) (with-tramp-connection-property
(tramp-set-connection-property vec "gid-integer" (tramp-get-local-gid 'integer))
vec "gid-integer" (tramp-get-local-gid 'integer)) (with-tramp-connection-property
(tramp-set-connection-property vec "uid-string" (tramp-get-local-uid 'string))
vec "uid-string" (tramp-get-local-uid 'string)) (with-tramp-connection-property
(tramp-set-connection-property vec "gid-string" (tramp-get-local-gid 'string)))
vec "gid-string" (tramp-get-local-gid 'string))))
(defun tramp-rclone-send-command (vec &rest args) (defun tramp-rclone-send-command (vec &rest args)
"Send the COMMAND to connection VEC." "Send the COMMAND to connection VEC."
......
...@@ -945,6 +945,7 @@ od -v -t x1 -A n </dev/null && \ ...@@ -945,6 +945,7 @@ od -v -t x1 -A n </dev/null && \
busybox awk '{}' </dev/null" busybox awk '{}' </dev/null"
"Test command for checking `tramp-awk-encode' and `tramp-awk-decode'.") "Test command for checking `tramp-awk-encode' and `tramp-awk-decode'.")
;;;###tramp-autoload
(defconst tramp-stat-marker "/////" (defconst tramp-stat-marker "/////"
"Marker in stat commands for file attributes.") "Marker in stat commands for file attributes.")
...@@ -1838,7 +1839,7 @@ be non-negative integers." ...@@ -1838,7 +1839,7 @@ be non-negative integers."
;; files. ;; files.
(defun tramp-sh-handle-file-name-all-completions (filename directory) (defun tramp-sh-handle-file-name-all-completions (filename directory)
"Like `file-name-all-completions' for Tramp files." "Like `file-name-all-completions' for Tramp files."
(unless (save-match-data (string-match "/" filename)) (unless (string-match-p "/" filename)
(all-completions (all-completions
filename filename
(with-parsed-tramp-file-name (expand-file-name directory) nil (with-parsed-tramp-file-name (expand-file-name directory) nil
...@@ -5114,6 +5115,7 @@ raises an error." ...@@ -5114,6 +5115,7 @@ raises an error."
"`%s' does not return a valid Lisp expression: `%s'" "`%s' does not return a valid Lisp expression: `%s'"
command (buffer-string)))))))) command (buffer-string))))))))
;;;###tramp-autoload
(defun tramp-convert-file-attributes (vec attr) (defun tramp-convert-file-attributes (vec attr)
"Convert `file-attributes' ATTR generated by perl script, stat or ls. "Convert `file-attributes' ATTR generated by perl script, stat or ls.
Convert file mode bits to string and set virtual device number. Convert file mode bits to string and set virtual device number.
......
...@@ -1796,12 +1796,12 @@ Result is the list (LOCALNAME MODE SIZE MTIME)." ...@@ -1796,12 +1796,12 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
(if (string-match "\\([ACDEHNORrsSTV]+\\)?$" line) (if (string-match "\\([ACDEHNORrsSTV]+\\)?$" line)
(setq (setq
mode (or (match-string 1 line) "") mode (or (match-string 1 line) "")
mode (save-match-data (format mode (format
"%s%s" "%s%s"
(if (string-match "D" mode) "d" "-") (if (string-match-p "D" mode) "d" "-")
(mapconcat (mapconcat
(lambda (_x) "") " " (lambda (_x) "") " "
(concat "r" (if (string-match "R" mode) "-" "w") "x")))) (concat "r" (if (string-match "R" mode) "-" "w") "x")))
line (substring line 0 -6)) line (substring line 0 -6))
(cl-return)) (cl-return))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment