emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 927d9f1: * lisp/net/tramp.el (tramp-set-file-uid-gi


From: Michael Albinus
Subject: [Emacs-diffs] master 927d9f1: * lisp/net/tramp.el (tramp-set-file-uid-gid): Fix thinko.
Date: Wed, 23 Jan 2019 09:24:07 -0500 (EST)

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

    * lisp/net/tramp.el (tramp-set-file-uid-gid): Fix thinko.
    
    * test/lisp/net/tramp-tests.el (tramp--test-instrument-test-case):
    Adapt docstring.
---
 lisp/net/tramp.el            |  8 +++++---
 test/lisp/net/tramp-tests.el | 27 +++++++++++++--------------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 6428e18..3c7770a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4355,9 +4355,11 @@ depending whether FILENAME is remote or local.  Both 
parameters
 must be non-negative integers.
 The setgid bit of the upper directory is respected.
 If FILENAME is remote, a file name handler is called."
-  (unless (zerop (logand #o2000 (file-modes (file-name-directory filename))))
-    (setq gid (tramp-compat-file-attribute-group-id
-              (file-attributes (file-name-directory filename) 'integer))))
+  (let* ((dir (file-name-directory filename))
+        (modes (file-modes dir)))
+    (when (and modes (not (zerop (logand modes #o2000))))
+      (setq gid (tramp-compat-file-attribute-group-id (file-attributes dir)))))
+
   (let ((handler (find-file-name-handler filename 'tramp-set-file-uid-gid)))
     (if handler
        (funcall handler 'tramp-set-file-uid-gid filename uid gid)
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 9deb794..58860c7 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -161,9 +161,9 @@ This shall used dynamically bound only.")
 
 (defmacro tramp--test-instrument-test-case (verbose &rest body)
   "Run BODY with `tramp-verbose' equal VERBOSE.
-Print the content of the Tramp debug buffer, if BODY does not
-eval properly in `should' or `should-not'.  `should-error' is not
-handled properly.  BODY shall not contain a timeout."
+Print the content of the Tramp connection and debug buffers, if
+`tramp-verbose' is greater than 3.  `should-error' is not handled
+properly.  BODY shall not contain a timeout."
   (declare (indent 1) (debug (natnump body)))
   `(let ((tramp-verbose (max (or ,verbose 0) (or tramp-verbose 0)))
         (tramp-message-show-message t)
@@ -2251,7 +2251,6 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   "Check `copy-file'."
   (skip-unless (tramp--test-enabled))
 
-  (tramp--test-instrument-test-case (if (getenv "EMACS_EMBA_CI") 10 0)
   ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
   (dolist (quoted (if (and (tramp--test-expensive-test) 
(tramp--test-emacs27-p))
                      '(nil t) '(nil)))
@@ -2278,10 +2277,10 @@ This checks also `file-name-as-directory', 
`file-name-directory',
                (with-temp-buffer
                  (insert-file-contents target)
                  (should (string-equal (buffer-string) "foo")))
-               ;; (when (tramp--test-expensive-test)
-               ;;   (should-error
-               ;;    (copy-file source target)
-               ;;    :type 'file-already-exists))
+               (when (tramp--test-expensive-test)
+                 (should-error
+                  (copy-file source target)
+                  :type 'file-already-exists))
                (copy-file source target 'ok))
 
            ;; Cleanup.
@@ -2297,11 +2296,11 @@ This checks also `file-name-as-directory', 
`file-name-directory',
                (should (file-exists-p source))
                (make-directory target)
                (should (file-directory-p target))
-               ;; ;; This has been changed in Emacs 26.1.
-               ;; (when (and (tramp--test-expensive-test) 
(tramp--test-emacs26-p))
-               ;;   (should-error
-               ;;    (copy-file source target)
-               ;;    :type 'file-already-exists))
+               ;; This has been changed in Emacs 26.1.
+               (when (and (tramp--test-expensive-test) (tramp--test-emacs26-p))
+                 (should-error
+                  (copy-file source target)
+                  :type 'file-already-exists))
                (copy-file source (file-name-as-directory target))
                (should
                 (file-exists-p
@@ -2358,7 +2357,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 
            ;; Cleanup.
            (ignore-errors (delete-directory source 'recursive))
-           (ignore-errors (delete-directory target 'recursive)))))))))
+           (ignore-errors (delete-directory target 'recursive))))))))
 
 (ert-deftest tramp-test12-rename-file ()
   "Check `rename-file'."



reply via email to

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