emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master c595d5d 1/2: Fix Bug#31068


From: Michael Albinus
Subject: [Emacs-diffs] master c595d5d 1/2: Fix Bug#31068
Date: Tue, 15 May 2018 05:08:17 -0400 (EDT)

branch: master
commit c595d5dd00980975286391151181883a8c71742d
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Fix Bug#31068
    
    * lisp/net/tramp-archive.el (tramp-archive-file-name-handler):
    Unregister unless `tramp-archive-enabled'.  (Bug#31068)
---
 lisp/net/tramp-archive.el | 50 ++++++++++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 448cfca..42c3d40 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -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 ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]