Fix Bug#29149

* lisp/net/tramp.el (tramp-drop-volume-letter): Handle also
backup file names.
(tramp-handle-find-backup-file-name):
Call `tramp-drop-volume-letter' on the results.  (Bug#29149)
This commit is contained in:
Michael Albinus 2017-11-20 14:28:22 +01:00
parent 5622b2e263
commit fc5b8f1055

View file

@ -1858,7 +1858,8 @@ letter into the file name. This function removes it."
(if (tramp-compat-file-name-quoted-p name) (if (tramp-compat-file-name-quoted-p name)
'tramp-compat-file-name-quote 'identity) 'tramp-compat-file-name-quote 'identity)
(let ((name (tramp-compat-file-name-unquote name))) (let ((name (tramp-compat-file-name-unquote name)))
(if (string-match "\\`[a-zA-Z]:/" name) ;; A volume letter could occur also in encoded backup file names.
(if (string-match "\\(\\`[[:alpha:]]:/\\|/!drive_[[:alpha:]]\\)" name)
(replace-match "/" nil t name) (replace-match "/" nil t name)
name))))) name)))))
@ -3222,21 +3223,23 @@ User is always nil."
(defun tramp-handle-find-backup-file-name (filename) (defun tramp-handle-find-backup-file-name (filename)
"Like `find-backup-file-name' for Tramp files." "Like `find-backup-file-name' for Tramp files."
(with-parsed-tramp-file-name filename nil (with-parsed-tramp-file-name filename nil
(let ((backup-directory-alist (mapcar
(if tramp-backup-directory-alist 'tramp-drop-volume-letter
(mapcar (let ((backup-directory-alist
(lambda (x) (if tramp-backup-directory-alist
(cons (mapcar
(car x) (lambda (x)
(if (and (stringp (cdr x)) (cons
(file-name-absolute-p (cdr x)) (car x)
(not (tramp-tramp-file-p (cdr x)))) (if (and (stringp (cdr x))
(tramp-make-tramp-file-name (file-name-absolute-p (cdr x))
method user domain host port (cdr x) hop) (not (tramp-tramp-file-p (cdr x))))
(cdr x)))) (tramp-make-tramp-file-name
tramp-backup-directory-alist) method user domain host port (cdr x) hop)
backup-directory-alist))) (cdr x))))
(tramp-run-real-handler 'find-backup-file-name (list filename))))) tramp-backup-directory-alist)
backup-directory-alist)))
(tramp-run-real-handler 'find-backup-file-name (list filename))))))
(defun tramp-handle-insert-directory (defun tramp-handle-insert-directory
(filename switches &optional wildcard full-directory-p) (filename switches &optional wildcard full-directory-p)