Commit c5f466db authored by Michael Albinus's avatar Michael Albinus

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)
parent ec3b436f
......@@ -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))
......
......@@ -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)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment