]> code.delx.au - gnu-emacs/commitdiff
Avoid recursive detection of remote uid and gid in tramp-gvfs.el
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 9 Jul 2016 12:20:07 +0000 (14:20 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 9 Jul 2016 12:20:07 +0000 (14:20 +0200)
* lisp/net/tramp-gvfs.el (tramp-gvfs-get-remote-uid-gid-in-progress):
New variable.
(tramp-gvfs-maybe-open-connection): Use it.

* test/lisp/net/tramp-tests.el (tramp-test18-file-attributes):
Reorder test.

lisp/net/tramp-gvfs.el
test/lisp/net/tramp-tests.el

index 038bb533c3e9de32fa3caacfc6baa2c25e13e34d..2b207f624e0f1221f9ddbea2082a52d9364d95e6 100644 (file)
@@ -1607,6 +1607,9 @@ ID-FORMAT valid values are `string' and `integer'."
        ((equal id-format 'integer) tramp-unknown-id-integer)
        ((equal id-format 'string) tramp-unknown-id-string)))))
 
        ((equal id-format 'integer) tramp-unknown-id-integer)
        ((equal id-format 'string) tramp-unknown-id-string)))))
 
+(defvar tramp-gvfs-get-remote-uid-gid-in-progress nil
+  "Indication, that remote uid and gid determination is in progress.")
+
 (defun tramp-gvfs-maybe-open-connection (vec)
   "Maybe open a connection VEC.
 Does not do anything if a connection is already open, but re-opens the
 (defun tramp-gvfs-maybe-open-connection (vec)
   "Maybe open a connection VEC.
 Does not do anything if a connection is already open, but re-opens the
@@ -1717,14 +1720,12 @@ connection if a previous connection has died for some reason."
 
   ;; In `tramp-check-cached-permissions', the connection properties
   ;; {uig,gid}-{integer,string} are used.  We set them to proper values.
 
   ;; In `tramp-check-cached-permissions', the connection properties
   ;; {uig,gid}-{integer,string} are used.  We set them to proper values.
-  (unless (tramp-get-connection-property vec "uid-integer" nil)
-    (tramp-gvfs-get-remote-uid vec 'integer))
-  (unless (tramp-get-connection-property vec "gid-integer" nil)
-    (tramp-gvfs-get-remote-gid vec 'integer))
-  (unless (tramp-get-connection-property vec "uid-string" nil)
-    (tramp-gvfs-get-remote-uid vec 'string))
-  (unless (tramp-get-connection-property vec "gid-string" nil)
-    (tramp-gvfs-get-remote-gid vec 'string)))
+  (unless tramp-gvfs-get-remote-uid-gid-in-progress
+    (let ((tramp-gvfs-get-remote-uid-gid-in-progress t))
+      (tramp-gvfs-get-remote-uid vec 'integer)
+      (tramp-gvfs-get-remote-gid vec 'integer)
+      (tramp-gvfs-get-remote-uid vec 'string)
+      (tramp-gvfs-get-remote-gid vec 'string))))
 
 (defun tramp-gvfs-send-command (vec command &rest args)
   "Send the COMMAND with its ARGS to connection VEC.
 
 (defun tramp-gvfs-send-command (vec command &rest args)
   "Send the COMMAND with its ARGS to connection VEC.
index f1f722b272bc1922fbc5c3f5396f1bc393521e70..a1ae78ab5c3ff4f807021a85314a5c93f61b49c9 100644 (file)
@@ -1113,12 +1113,12 @@ This tests also `file-readable-p' and `file-regular-p'."
        (progn
          (write-region "foo" nil tmp-name1)
          (should (file-exists-p tmp-name1))
        (progn
          (write-region "foo" nil tmp-name1)
          (should (file-exists-p tmp-name1))
-         (setq attr (file-attributes tmp-name1))
-         (should (consp attr))
-         (should (file-exists-p tmp-name1))
          (should (file-readable-p tmp-name1))
          (should (file-regular-p tmp-name1))
          (should (file-readable-p tmp-name1))
          (should (file-regular-p tmp-name1))
+
          ;; We do not test inodes and device numbers.
          ;; We do not test inodes and device numbers.
+         (setq attr (file-attributes tmp-name1))
+         (should (consp attr))
          (should (null (car attr)))
           (should (numberp (nth 1 attr))) ;; Link.
           (should (numberp (nth 2 attr))) ;; Uid.
          (should (null (car attr)))
           (should (numberp (nth 1 attr))) ;; Link.
           (should (numberp (nth 2 attr))) ;; Uid.