diff options
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r-- | lisp/net/tramp.el | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index f0b17ef3934..123d01c747d 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4031,9 +4031,15 @@ Let-bind it when necessary.") "Like `file-regular-p' for Tramp files." (and (file-exists-p filename) ;; Sometimes, `file-attributes' does not return a proper value - ;; even if `file-exists-p' does. - (when-let ((attr (file-attributes filename))) - (eq ?- (aref (file-attribute-modes attr) 0))))) + ;; even if `file-exists-p' does. Protect by `ignore-errors', + ;; because `file-truename' could raise an error for cyclic + ;; symlinks. + (ignore-errors + (when-let ((attr (file-attributes filename))) + (cond + ((eq ?- (aref (file-attribute-modes attr) 0))) + ((eq ?l (aref (file-attribute-modes attr) 0)) + (file-regular-p (file-truename filename)))))))) (defun tramp-handle-file-remote-p (filename &optional identification connected) "Like `file-remote-p' for Tramp files." |