From c5f466db6f6b8196b8429db8bb7b74f8090d5d3e Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 1 Feb 2016 11:48:43 +0100 Subject: [PATCH] Fix Bug#20821 * lisp/net/tramp.el (tramp-file-name-handler): * lisp/net/tramp-sh.el (tramp-sh-handle-expand-file-name): Use `tramp-drop-volume-letter'. (Bug#20821) --- lisp/net/tramp-sh.el | 9 +++++---- lisp/net/tramp.el | 15 ++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 7e0b13ddf00..8d01a4b2120 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -497,7 +497,7 @@ The string is used in `tramp-methods'.") ;; "getconf PATH" yields: ;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin ;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin -;; GNU/Linux (Debian, Suse): /bin:/usr/bin +;; GNU/Linux (Debian, Suse, RHEL): /bin:/usr/bin ;; FreeBSD: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"! ;; Darwin: /usr/bin:/bin:/usr/sbin:/sbin ;; IRIX64: /usr/bin @@ -2797,7 +2797,7 @@ The method used must be an out-of-band method." (narrow-to-region (point) (point)) ;; We cannot use `insert-buffer-substring' because the Tramp ;; buffer changes its contents before insertion due to calling - ;; `expand-file' and alike. + ;; `expand-file-name' and alike. (insert (with-current-buffer (tramp-get-buffer v) (buffer-string))) @@ -2860,9 +2860,10 @@ the result will be a local, non-Tramp, file name." ;; Unless NAME is absolute, concat DIR and NAME. (unless (file-name-absolute-p name) (setq name (concat (file-name-as-directory dir) name))) - ;; If NAME is not a Tramp file, run the real handler. + ;; If connection is not established yet, run the real handler. (if (not (tramp-connectable-p name)) - (tramp-run-real-handler 'expand-file-name (list name nil)) + (tramp-drop-volume-letter + (tramp-run-real-handler 'expand-file-name (list name nil))) ;; Dissect NAME. (with-parsed-tramp-file-name name nil (unless (tramp-run-real-handler 'file-name-absolute-p (list localname)) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 6d8ea021ef3..3b8510ede48 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1987,13 +1987,13 @@ Falls back to normal file name handler if no Tramp file name handler exists." (tramp-replace-environment-variables (apply 'tramp-file-name-for-operation operation args))) (completion (tramp-completion-mode-p)) - (foreign (tramp-find-foreign-file-name-handler filename))) + (foreign (tramp-find-foreign-file-name-handler filename)) + result) (with-parsed-tramp-file-name filename nil ;; Call the backend function. (if foreign (tramp-condition-case-unless-debug err - (let ((sf (symbol-function foreign)) - result) + (let ((sf (symbol-function foreign))) ;; Some packages set the default directory to a ;; remote path, before respective Tramp packages ;; are already loaded. This results in @@ -2057,8 +2057,13 @@ Falls back to normal file name handler if no Tramp file name handler exists." ;; Propagate the error. (t (signal (car err) (cdr err)))))) - ;; Nothing to do for us. - (tramp-run-real-handler operation args))))) + ;; Nothing to do for us. However, since we are in + ;; `tramp-mode', we must suppress the volume letter on + ;; MS Windows. + (setq result (tramp-run-real-handler operation args)) + (if (stringp result) + (tramp-drop-volume-letter result) + result))))) ;; When `tramp-mode' is not enabled, we don't do anything. (tramp-run-real-handler operation args))) -- 2.39.2