aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2018-05-15 11:06:18 +0200
committerMichael Albinus2018-05-15 11:06:18 +0200
commitc595d5dd00980975286391151181883a8c71742d (patch)
tree48c0c7d633225c18aef53585d93c15aeb27d38d3
parent30bd61d67433c72641cb4d9a020b3c263aa6170f (diff)
downloademacs-c595d5dd00980975286391151181883a8c71742d.tar.gz
emacs-c595d5dd00980975286391151181883a8c71742d.zip
Fix Bug#31068
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler): Unregister unless `tramp-archive-enabled'. (Bug#31068)
-rw-r--r--lisp/net/tramp-archive.el50
1 files changed, 28 insertions, 22 deletions
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 448cfca2ca1..42c3d40c1bb 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -117,7 +117,7 @@
117(defvar url-tramp-protocols) 117(defvar url-tramp-protocols)
118 118
119;; We cannot check `tramp-gvfs-enabled' in loaddefs.el, because this 119;; We cannot check `tramp-gvfs-enabled' in loaddefs.el, because this
120;; would load Tramp. So we make a cheaper check. 120;; would load Tramp. So we make a cheaper check.
121;;;###autoload 121;;;###autoload
122(defvar tramp-archive-enabled (featurep 'dbusbind) 122(defvar tramp-archive-enabled (featurep 'dbusbind)
123 "Non-nil when file archive support is available.") 123 "Non-nil when file archive support is available.")
@@ -302,27 +302,33 @@ pass to the OPERATION."
302 "Invoke the file archive related OPERATION. 302 "Invoke the file archive related OPERATION.
303First arg specifies the OPERATION, second arg is a list of arguments to 303First arg specifies the OPERATION, second arg is a list of arguments to
304pass to the OPERATION." 304pass to the OPERATION."
305 (let* ((filename (apply 'tramp-archive-file-name-for-operation 305 (if (not tramp-archive-enabled)
306 operation args)) 306 ;; Unregister `tramp-archive-file-name-handler'.
307 (archive (tramp-archive-file-name-archive filename))) 307 (progn
308 ;; The file archive could be a directory, see Bug#30293. 308 (tramp-register-file-name-handlers)
309 (if (and archive 309 (tramp-archive-run-real-handler operation args))
310 (tramp-archive-run-real-handler 'file-directory-p (list archive))) 310
311 (tramp-archive-run-real-handler operation args) 311 (let* ((filename (apply 'tramp-archive-file-name-for-operation
312 ;; Now run the handler. 312 operation args))
313 (unless tramp-archive-enabled 313 (archive (tramp-archive-file-name-archive filename)))
314 (tramp-user-error nil "Package `tramp-archive' not supported")) 314
315 (let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods)) 315 ;; The file archive could be a directory, see Bug#30293.
316 (tramp-gvfs-methods tramp-archive-all-gvfs-methods) 316 (if (and archive
317 ;; Set uid and gid. gvfsd-archive could do it, but it doesn't. 317 (tramp-archive-run-real-handler
318 (tramp-unknown-id-integer (user-uid)) 318 'file-directory-p (list archive)))
319 (tramp-unknown-id-string (user-login-name)) 319 (tramp-archive-run-real-handler operation args)
320 (fn (assoc operation tramp-archive-file-name-handler-alist))) 320 ;; Now run the handler.
321 (when (eq (cdr fn) 'tramp-archive-handle-not-implemented) 321 (let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods))
322 (setq args (cons operation args))) 322 (tramp-gvfs-methods tramp-archive-all-gvfs-methods)
323 (if fn 323 ;; Set uid and gid. gvfsd-archive could do it, but it doesn't.
324 (save-match-data (apply (cdr fn) args)) 324 (tramp-unknown-id-integer (user-uid))
325 (tramp-archive-run-real-handler operation args)))))) 325 (tramp-unknown-id-string (user-login-name))
326 (fn (assoc operation tramp-archive-file-name-handler-alist)))
327 (when (eq (cdr fn) 'tramp-archive-handle-not-implemented)
328 (setq args (cons operation args)))
329 (if fn
330 (save-match-data (apply (cdr fn) args))
331 (tramp-archive-run-real-handler operation args)))))))
326 332
327;;;###autoload 333;;;###autoload
328(progn (defun tramp-register-archive-file-name-handler () 334(progn (defun tramp-register-archive-file-name-handler ()