emacs-diffs
[Top][All Lists]
Advanced

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

master 12a193f: Fix problem in `shadow-define-literal-group' (Bug#49596)


From: Michael Albinus
Subject: master 12a193f: Fix problem in `shadow-define-literal-group' (Bug#49596)
Date: Sun, 18 Jul 2021 09:57:49 -0400 (EDT)

branch: master
commit 12a193f8769ceb205261bd5804f5e5c808866a4f
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Fix problem in `shadow-define-literal-group' (Bug#49596)
    
    * 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            |  8 ++++++--
 test/lisp/shadowfile-tests.el | 15 +++++++++++----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el
index f39f173..ec3a27b 100644
--- a/lisp/shadowfile.el
+++ b/lisp/shadowfile.el
@@ -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
diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el
index 268bb64..c571dc3 100644
--- a/test/lisp/shadowfile-tests.el
+++ b/test/lisp/shadowfile-tests.el
@@ -69,12 +69,15 @@
       (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))))



reply via email to

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