;; 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:
;; 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:
(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
;; 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."
busybox awk '{}' </dev/null"
"Test command for checking `tramp-awk-encode' and `tramp-awk-decode'.")
+;;;###tramp-autoload
(defconst tramp-stat-marker "/////"
"Marker in stat commands for file attributes.")
;; files.
(defun tramp-sh-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
"`%s' does not return a valid Lisp expression: `%s'"
command (buffer-string))))))))
+;;;###tramp-autoload
(defun tramp-convert-file-attributes (vec attr)
"Convert `file-attributes' ATTR generated by perl script, stat or ls.
Convert file mode bits to string and set virtual device number.
(if (string-match "\\([ACDEHNORrsSTV]+\\)?$" line)
(setq
mode (or (match-string 1 line) "")
- mode (save-match-data (format
+ mode (format
"%s%s"
- (if (string-match "D" mode) "d" "-")
+ (if (string-match-p "D" mode) "d" "-")
(mapconcat
(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))
(cl-return))