summaryrefslogtreecommitdiff
path: root/lisp/net/tramp.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2022-09-11 14:53:14 +0200
committerMichael Albinus <michael.albinus@gmx.de>2022-09-11 14:53:14 +0200
commitcba83d989359d667e52dad4e0e9eadf6f77cc38f (patch)
treee21e822010ca2459725a915c996e9a0bcb724777 /lisp/net/tramp.el
parentf47a5324f44e5b8d0016cff2a4f995ff418a5d19 (diff)
downloademacs-cba83d989359d667e52dad4e0e9eadf6f77cc38f.tar.gz
emacs-cba83d989359d667e52dad4e0e9eadf6f77cc38f.tar.bz2
emacs-cba83d989359d667e52dad4e0e9eadf6f77cc38f.zip
Disable Tramp cache for relative file names
* lisp/net/tramp.el (tramp-file-name-unify): Return `tramp-cache-undefined' if LOCALNAME is a relative file name. * lisp/net/tramp-cache.el (tramp-get-file-property) (tramp-set-file-property, tramp-file-property-p) (tramp-flush-file-property, tramp-flush-file-upper-properties) (tramp-flush-file-properties): Handle KEY being `tramp-cache-undefined'. (tramp-flush-file-function): Revert last change.
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r--lisp/net/tramp.el28
1 files changed, 13 insertions, 15 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 15380ed94dd..90cc03c188e 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1504,23 +1504,21 @@ If nil, return `tramp-default-port'."
;;;###tramp-autoload
(defun tramp-file-name-unify (vec &optional localname)
"Unify VEC by removing localname and hop from `tramp-file-name' structure.
-If LOCALNAME is a string, set it as localname.
+If LOCALNAME is an absolute file name, set it as localname. If
+LOCALNAME is a relative file name, return `tramp-cache-undefined'.
Objects returned by this function compare `equal' if they refer to the
same connection. Make a copy in order to avoid side effects."
- (when (tramp-file-name-p vec)
- (setq vec (copy-tramp-file-name vec))
- (setf (tramp-file-name-localname vec)
- (and (stringp localname)
- ;; FIXME: This is a sanity check. When this error
- ;; doesn't happen for a while, it can be removed.
- (or (file-name-absolute-p localname)
- (tramp-error
- vec 'file-error
- "File `%s' must be absolute, please report a bug!"
- localname))
- (tramp-compat-file-name-unquote (directory-file-name localname)))
- (tramp-file-name-hop vec) nil))
- vec)
+ (if (and (stringp localname)
+ (not (file-name-absolute-p localname)))
+ (setq vec tramp-cache-undefined)
+ (when (tramp-file-name-p vec)
+ (setq vec (copy-tramp-file-name vec))
+ (setf (tramp-file-name-localname vec)
+ (and (stringp localname)
+ (tramp-compat-file-name-unquote
+ (directory-file-name localname)))
+ (tramp-file-name-hop vec) nil))
+ vec))
(put #'tramp-file-name-unify 'tramp-suppress-trace t)