emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f06915c93c: Tilde expansion is not possible for Tramp sshfs metho


From: Michael Albinus
Subject: master f06915c93c: Tilde expansion is not possible for Tramp sshfs method
Date: Wed, 9 Feb 2022 11:02:43 -0500 (EST)

branch: master
commit f06915c93c0755a708f9c600e90674c68b5326dc
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Tilde expansion is not possible for Tramp sshfs method
    
    * lisp/net/tramp.el (tramp-handle-expand-file-name):
    Tilde expansion is not possible.  (Bug#53847)
---
 lisp/net/tramp.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 05a80e1dcf..1b5de46016 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3474,19 +3474,19 @@ User is always nil."
     (with-parsed-tramp-file-name name nil
       (unless (tramp-run-real-handler #'file-name-absolute-p (list localname))
        (setq localname (concat "/" localname)))
+      ;; Tilde expansion is not possible.
+      (when (string-match-p "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname)
+       (tramp-error v 'file-error "Cannot expand tilde in file `%s'" name))
       ;; Do not keep "/..".
       (when (string-match-p "^/\\.\\.?$" localname)
        (setq localname "/"))
-      ;; Do normal `expand-file-name' (this does "/./" and "/../"),
-      ;; unless there are tilde characters in file name.
+      ;; Do normal `expand-file-name' (this does "/./" and "/../").
       ;; `default-directory' is bound, because on Windows there would
       ;; be problems with UNC shares or Cygwin mounts.
       (let ((default-directory tramp-compat-temporary-file-directory))
        (tramp-make-tramp-file-name
-        v (if (string-match-p "\\`~" localname)
-              localname
-            (tramp-drop-volume-letter
-             (tramp-run-real-handler #'expand-file-name (list 
localname)))))))))
+        v (tramp-drop-volume-letter
+           (tramp-run-real-handler #'expand-file-name (list localname))))))))
 
 (defun tramp-handle-file-accessible-directory-p (filename)
   "Like `file-accessible-directory-p' for Tramp files."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]