]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix problem in `shadow-define-literal-group' (Bug#49596)
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 18 Jul 2021 13:57:41 +0000 (15:57 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 18 Jul 2021 13:57:41 +0000 (15:57 +0200)
* lisp/shadowfile.el (shadow-make-fullname): HOST can also be a
remote file name.  Bug#49596.

* test/lisp/shadowfile-tests.el (auth-source-save-behavior)
(tramp-cache-read-persistent-data, tramp-persistency-file-name):
Set them globally.
(shadow-test06-literal-groups): Extend test.

lisp/shadowfile.el
test/lisp/shadowfile-tests.el

index f39f17329f28281cc1093374af15a28830e5b13b..ec3a27b9911c0e5a1f8f8cb861f3cacfd891f1f1 100644 (file)
@@ -284,9 +284,13 @@ Argument can be a simple name, remote file name, or already a
 
 (defsubst shadow-make-fullname (hup &optional host name)
   "Make a Tramp style fullname out of HUP, a `tramp-file-name' structure.
-Replace HOST, and NAME when non-nil."
+Replace HOST, and NAME when non-nil.  HOST can also be a remote file name."
   (let ((hup (copy-tramp-file-name hup)))
-    (when host (setf (tramp-file-name-host hup) host))
+    (when host
+      (if (file-remote-p host)
+          (setq name (or name (and hup (tramp-file-name-localname hup)))
+                hup (tramp-dissect-file-name (file-remote-p host)))
+        (setf (tramp-file-name-host hup) host)))
     (when name (setf (tramp-file-name-localname hup) name))
     (if (null (tramp-file-name-method hup))
        (format
index 268bb64f241426ce24ebea944517cda5798496db..c571dc3e14b79f4a2e1d38ada4cb1dcbdc7cc9ec 100644 (file)
       (format "/mock::%s" temporary-file-directory)))
   "Temporary directory for Tramp tests.")
 
-(setq password-cache-expiry nil
+(setq auth-source-save-behavior nil
+      password-cache-expiry nil
       shadow-debug (or (getenv "EMACS_HYDRA_CI") (getenv "EMACS_EMBA_CI"))
-      tramp-verbose 0
       ;; When the remote user id is 0, Tramp refuses unsafe temporary files.
       tramp-allow-unsafe-temporary-files
       (or tramp-allow-unsafe-temporary-files noninteractive)
+      tramp-cache-read-persistent-data t ;; For auth-sources.
+      tramp-persistency-file-name nil
+      tramp-verbose 0
       ;; On macOS, `temporary-file-directory' is a symlinked directory.
       temporary-file-directory (file-truename temporary-file-directory)
       shadow-test-remote-temporary-file-directory
@@ -643,7 +646,9 @@ guaranteed by the originator of a cluster definition."
                 (expand-file-name
                  "shadowfile-tests"
                  shadow-test-remote-temporary-file-directory))
-               mocked-input `(,cluster1 ,file1 ,cluster2 ,file2 ,(kbd "RET")))
+               mocked-input
+                `(,cluster1 ,file1 ,cluster2 ,file2
+                  ,primary ,file1 ,(kbd "RET")))
          (with-temp-buffer
             (set-visited-file-name file1)
            (call-interactively #'shadow-define-literal-group)
@@ -657,7 +662,9 @@ guaranteed by the originator of a cluster definition."
          (should (member (format "/%s:%s" cluster1 (file-local-name file1))
                           (car shadow-literal-groups)))
          (should (member (format "/%s:%s" cluster2 (file-local-name file2))
-                          (car shadow-literal-groups))))
+                          (car shadow-literal-groups)))
+          ;; Bug#49596.
+         (should (member (concat primary file1) (car shadow-literal-groups))))
 
       ;; Cleanup.
       (shadow--tests-cleanup))))