mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-16 10:50:49 -08:00
* net/tramp.el (tramp-handle-file-truename): Cache only the local
file name. * net/tramp-cache.el (tramp-flush-file-property): Flush also properties of linked files. (Bug#9879)
This commit is contained in:
parent
9d0cfcd67d
commit
d0c8fc8abb
3 changed files with 114 additions and 97 deletions
|
|
@ -1,3 +1,11 @@
|
|||
2011-11-16 Michael Albinus <michael.albinus@gmx.de>
|
||||
|
||||
* net/tramp.el (tramp-handle-file-truename): Cache only the local
|
||||
file name.
|
||||
|
||||
* net/tramp-cache.el (tramp-flush-file-property): Flush also
|
||||
properties of linked files. (Bug#9879)
|
||||
|
||||
2011-11-16 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* menu-bar.el (menu-bar-file-menu):
|
||||
|
|
|
|||
|
|
@ -162,6 +162,11 @@ FILE must be a local file name on a connection identified via VEC."
|
|||
;;;###tramp-autoload
|
||||
(defun tramp-flush-file-property (vec file)
|
||||
"Remove all properties of FILE in the cache context of VEC."
|
||||
;; Remove file property of symlinks.
|
||||
(let ((truename (tramp-get-file-property vec file "file-truename" nil)))
|
||||
(when (and (stringp truename)
|
||||
(not (string-equal file truename)))
|
||||
(tramp-flush-file-property vec truename)))
|
||||
;; Unify localname.
|
||||
(setq vec (copy-sequence vec))
|
||||
(aset vec 3 (tramp-run-real-handler 'directory-file-name (list file)))
|
||||
|
|
|
|||
|
|
@ -1058,6 +1058,7 @@ target of the symlink differ."
|
|||
(defun tramp-sh-handle-file-truename (filename &optional counter prev-dirs)
|
||||
"Like `file-truename' for Tramp files."
|
||||
(with-parsed-tramp-file-name (expand-file-name filename) nil
|
||||
(tramp-make-tramp-file-name method user host
|
||||
(with-file-property v localname "file-truename"
|
||||
(let ((result nil)) ; result steps in reverse order
|
||||
(tramp-message v 4 "Finding true name for `%s'" filename)
|
||||
|
|
@ -1093,8 +1094,8 @@ target of the symlink differ."
|
|||
(thisstep nil)
|
||||
(numchase 0)
|
||||
;; Don't make the following value larger than
|
||||
;; necessary. People expect an error message in a
|
||||
;; timely fashion when something is wrong;
|
||||
;; necessary. People expect an error message in
|
||||
;; a timely fashion when something is wrong;
|
||||
;; otherwise they might think that Emacs is hung.
|
||||
;; Of course, correctness has to come first.
|
||||
(numchase-limit 20)
|
||||
|
|
@ -1122,18 +1123,20 @@ target of the symlink differ."
|
|||
(pop result))
|
||||
((stringp symlink-target)
|
||||
;; It's a symlink, follow it.
|
||||
(tramp-message v 5 "Follow symlink to %s" symlink-target)
|
||||
(tramp-message
|
||||
v 5 "Follow symlink to %s" symlink-target)
|
||||
(setq numchase (1+ numchase))
|
||||
(when (file-name-absolute-p symlink-target)
|
||||
(setq result nil))
|
||||
;; If the symlink was absolute, we'll get a string like
|
||||
;; "/user@host:/some/target"; extract the
|
||||
;; "/some/target" part from it.
|
||||
;; If the symlink was absolute, we'll get a
|
||||
;; string like "/user@host:/some/target";
|
||||
;; extract the "/some/target" part from it.
|
||||
(when (tramp-tramp-file-p symlink-target)
|
||||
(unless (tramp-equal-remote filename symlink-target)
|
||||
(tramp-error
|
||||
v 'file-error
|
||||
"Symlink target `%s' on wrong host" symlink-target))
|
||||
"Symlink target `%s' on wrong host"
|
||||
symlink-target))
|
||||
(setq symlink-target localname))
|
||||
(setq steps
|
||||
(append (tramp-compat-split-string
|
||||
|
|
@ -1152,12 +1155,13 @@ target of the symlink differ."
|
|||
(if result
|
||||
(mapconcat 'identity (cons "" result) "/")
|
||||
"/"))
|
||||
(when (and is-dir (or (string= "" result)
|
||||
(when (and is-dir
|
||||
(or (string= "" result)
|
||||
(not (string= (substring result -1) "/"))))
|
||||
(setq result (concat result "/"))))))
|
||||
|
||||
(tramp-message v 4 "True name of `%s' is `%s'" filename result)
|
||||
(tramp-make-tramp-file-name method user host result)))))
|
||||
(tramp-message v 4 "True name of `%s' is `%s'" localname result)
|
||||
result)))))
|
||||
|
||||
;; Basic functions.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue