[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 40fdbb0: Work on Tramp's file-truename
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] emacs-26 40fdbb0: Work on Tramp's file-truename |
Date: |
Tue, 19 Sep 2017 12:12:45 -0400 (EDT) |
branch: emacs-26
commit 40fdbb01d0017e9e164a24aeb760056778975e65
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Work on Tramp's file-truename
* lisp/net/tramp-sh.el (tramp-perl-file-truename):
Check also for symlinks.
(tramp-sh-handle-file-truename): Move check for a symlink
cycle to the end. Do not blame symlinks which look like a
remote file name.
* lisp/net/tramp.el (tramp-handle-file-truename): Expand result.
---
lisp/net/tramp-sh.el | 26 +++++++++-----------------
lisp/net/tramp.el | 6 +++---
2 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 5f145d4..a744a53 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -613,7 +613,7 @@ use Cwd \"realpath\";
sub myrealpath {
my ($file) = @_;
- return realpath($file) if -e $file;
+ return realpath($file) if (-e $file || -l $file);
}
sub recursive {
@@ -1139,12 +1139,7 @@ component is used as the target of the symlink."
(tramp-shell-quote-argument localname)))
(with-current-buffer (tramp-get-connection-buffer v)
(goto-char (point-min))
- (setq result (buffer-substring (point-min) (point-at-eol))))
- (when (and (file-symlink-p filename)
- (string-equal result localname))
- (tramp-error
- v 'file-error
- "Apparent cycle of symbolic links for %s" filename)))
+ (setq result (buffer-substring (point-min) (point-at-eol)))))
;; Use Perl implementation.
((and (tramp-get-remote-perl v)
@@ -1198,16 +1193,6 @@ component is used as the target of the symlink."
(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 "/address@hidden:/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))
- (setq symlink-target localname))
(setq steps
(append
(split-string symlink-target "/" 'omit) steps)))
@@ -1226,6 +1211,13 @@ component is used as the target of the symlink."
"/"))
(when (string= "" result)
(setq result "/")))))
+
+ ;; Detect cycle.
+ (when (and (file-symlink-p filename)
+ (string-equal result localname))
+ (tramp-error
+ v 'file-error
+ "Apparent cycle of symbolic links for %s" filename))
;; If the resulting localname looks remote, we must quote it
;; for security reasons.
(when (or quoted (file-remote-p result))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index abcd528..3573eeb 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3169,7 +3169,7 @@ User is always nil."
(defun tramp-handle-file-truename (filename)
"Like `file-truename' for Tramp files."
- (let ((result filename)
+ (let ((result (expand-file-name filename))
(numchase 0)
;; Don't make the following value larger than
;; necessary. People expect an error message in a
@@ -3180,7 +3180,7 @@ User is always nil."
symlink-target)
(format
"%s%s"
- (with-parsed-tramp-file-name (expand-file-name result) v1
+ (with-parsed-tramp-file-name result v1
(with-tramp-file-property v1 v1-localname "file-truename"
(while (and (setq symlink-target (file-symlink-p result))
(< numchase numchase-limit))
@@ -3850,7 +3850,7 @@ Erase echoed commands if exists."
(min (+ (point-min) tramp-echo-mark-marker-length)
(point-max))))))
;; No echo to be handled, now we can look for the regexp.
- ;; Sometimes, lines are much to long, and we run into a "Stack
+ ;; Sometimes, lines are much too long, and we run into a "Stack
;; overflow in regexp matcher". For example, //DIRED// lines of
;; directory listings with some thousand files. Therefore, we
;; look from the end.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 40fdbb0: Work on Tramp's file-truename,
Michael Albinus <=