diff options
Diffstat (limited to 'lisp/net/tramp-ftp.el')
-rw-r--r-- | lisp/net/tramp-ftp.el | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index 650e839f823..dd7e0f9f342 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el @@ -125,7 +125,7 @@ pass to the OPERATION." ;; "ftp" method is used in the Tramp file name. So we unset ;; those values. (ange-ftp-ftp-name-arg "") - (ange-ftp-ftp-name-res nil)) + ange-ftp-ftp-name-res) (cond ;; If argument is a symlink, `file-directory-p' and ;; `file-exists-p' call the traversed file recursively. So we @@ -135,12 +135,21 @@ pass to the OPERATION." ;; completion. We don't use `with-parsed-tramp-file-name', ;; because this returns another user but the one declared in ;; "~/.netrc". + ;; For file names which look like Tramp archive files like + ;; "/ftp:anonymous@ftp.gnu.org:/gnu/tramp/tramp-2.0.39.tar.gz", + ;; we must disable tramp-archive.el, because in + ;; `ange-ftp-get-files' this is "normalized" by + ;; `file-name-as-directory' with unwelcome side side-effects. + ;; This disables the file archive functionality, perhaps we + ;; could fix this otherwise. (Bug#56078) ((memq operation '(file-directory-p file-exists-p)) - (if (apply #'ange-ftp-hook-function operation args) + (cl-letf (((symbol-function #'tramp-archive-file-name-handler) + (lambda (operation &rest args) + (tramp-archive-run-real-handler operation args)))) + (prog1 (apply #'ange-ftp-hook-function operation args) (let ((v (tramp-dissect-file-name (car args) t))) (setf (tramp-file-name-method v) tramp-ftp-method) - (tramp-set-connection-property v "started" t)) - nil)) + (tramp-set-connection-property v "started" t))))) ;; If the second argument of `copy-file' or `rename-file' is a ;; remote file name but via FTP, ange-ftp doesn't check this. @@ -175,11 +184,10 @@ pass to the OPERATION." ;; It must be a `defsubst' in order to push the whole code into ;; tramp-loaddefs.el. Otherwise, there would be recursive autoloading. ;;;###tramp-autoload -(defsubst tramp-ftp-file-name-p (filename) - "Check if it's a FILENAME that should be forwarded to Ange-FTP." - (and (tramp-tramp-file-p filename) - (string= (tramp-file-name-method (tramp-dissect-file-name filename)) - tramp-ftp-method))) +(defsubst tramp-ftp-file-name-p (vec-or-filename) + "Check if it's a VEC-OR-FILENAME that should be forwarded to Ange-FTP." + (when-let* ((vec (tramp-ensure-dissected-file-name vec-or-filename))) + (string= (tramp-file-name-method vec) tramp-ftp-method))) ;;;###tramp-autoload (tramp--with-startup |