mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-07 15:21:46 +00:00
Fix Bug#31068
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler): Unregister unless `tramp-archive-enabled'. (Bug#31068)
This commit is contained in:
parent
30bd61d674
commit
c595d5dd00
@ -117,7 +117,7 @@
|
||||
(defvar url-tramp-protocols)
|
||||
|
||||
;; We cannot check `tramp-gvfs-enabled' in loaddefs.el, because this
|
||||
;; would load Tramp. So we make a cheaper check.
|
||||
;; would load Tramp. So we make a cheaper check.
|
||||
;;;###autoload
|
||||
(defvar tramp-archive-enabled (featurep 'dbusbind)
|
||||
"Non-nil when file archive support is available.")
|
||||
@ -302,27 +302,33 @@ pass to the OPERATION."
|
||||
"Invoke the file archive related OPERATION.
|
||||
First arg specifies the OPERATION, second arg is a list of arguments to
|
||||
pass to the OPERATION."
|
||||
(let* ((filename (apply 'tramp-archive-file-name-for-operation
|
||||
operation args))
|
||||
(archive (tramp-archive-file-name-archive filename)))
|
||||
;; The file archive could be a directory, see Bug#30293.
|
||||
(if (and archive
|
||||
(tramp-archive-run-real-handler 'file-directory-p (list archive)))
|
||||
(tramp-archive-run-real-handler operation args)
|
||||
;; Now run the handler.
|
||||
(unless tramp-archive-enabled
|
||||
(tramp-user-error nil "Package `tramp-archive' not supported"))
|
||||
(let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods))
|
||||
(tramp-gvfs-methods tramp-archive-all-gvfs-methods)
|
||||
;; Set uid and gid. gvfsd-archive could do it, but it doesn't.
|
||||
(tramp-unknown-id-integer (user-uid))
|
||||
(tramp-unknown-id-string (user-login-name))
|
||||
(fn (assoc operation tramp-archive-file-name-handler-alist)))
|
||||
(when (eq (cdr fn) 'tramp-archive-handle-not-implemented)
|
||||
(setq args (cons operation args)))
|
||||
(if fn
|
||||
(save-match-data (apply (cdr fn) args))
|
||||
(tramp-archive-run-real-handler operation args))))))
|
||||
(if (not tramp-archive-enabled)
|
||||
;; Unregister `tramp-archive-file-name-handler'.
|
||||
(progn
|
||||
(tramp-register-file-name-handlers)
|
||||
(tramp-archive-run-real-handler operation args))
|
||||
|
||||
(let* ((filename (apply 'tramp-archive-file-name-for-operation
|
||||
operation args))
|
||||
(archive (tramp-archive-file-name-archive filename)))
|
||||
|
||||
;; The file archive could be a directory, see Bug#30293.
|
||||
(if (and archive
|
||||
(tramp-archive-run-real-handler
|
||||
'file-directory-p (list archive)))
|
||||
(tramp-archive-run-real-handler operation args)
|
||||
;; Now run the handler.
|
||||
(let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods))
|
||||
(tramp-gvfs-methods tramp-archive-all-gvfs-methods)
|
||||
;; Set uid and gid. gvfsd-archive could do it, but it doesn't.
|
||||
(tramp-unknown-id-integer (user-uid))
|
||||
(tramp-unknown-id-string (user-login-name))
|
||||
(fn (assoc operation tramp-archive-file-name-handler-alist)))
|
||||
(when (eq (cdr fn) 'tramp-archive-handle-not-implemented)
|
||||
(setq args (cons operation args)))
|
||||
(if fn
|
||||
(save-match-data (apply (cdr fn) args))
|
||||
(tramp-archive-run-real-handler operation args)))))))
|
||||
|
||||
;;;###autoload
|
||||
(progn (defun tramp-register-archive-file-name-handler ()
|
||||
|
Loading…
Reference in New Issue
Block a user