Stephen Berman <[email protected]> writes:

Hi Stephen,

> I applied the patch and rebuilt, cleared all Tramp connections,
> restarted Emacs, activated the VPN tunnel and tried to access the
> remoted directory, but got the same error.  I've attached a gzipped
> verbosity level 10 trace.

Thanks. The problem is more difficult. Tramp believes that the remote
uid/gid is 0 (which is the value of the root location "/"). Because of
this, Tramp regards file modes "drwxr-s---" of directory "/b/bermasbp/"
as unreadable, because this directory is owned by "unix::uid=45845" and
"unix::gid=33".

I've prepared another patch (appended), which makes the check
weaker. Could you, pls, test?

> Steve Berman

Best regards, Michael.

diff --git a/lisp/tramp-gvfs.el b/lisp/tramp-gvfs.el
index d3af9f47..d3634b0c 100644
--- a/lisp/tramp-gvfs.el
+++ b/lisp/tramp-gvfs.el
@@ -1385,7 +1385,8 @@ If FILE-SYSTEM is non-nil, return file system attributes."
   "Like `file-executable-p' for Tramp files."
   (with-parsed-tramp-file-name filename nil
     (with-tramp-file-property v localname "file-executable-p"
-      (tramp-check-cached-permissions v ?x))))
+      (or (tramp-check-cached-permissions v ?x)
+	  (tramp-check-cached-permissions v ?s)))))

 (defun tramp-gvfs-handle-file-name-all-completions (filename directory)
   "Like `file-name-all-completions' for Tramp files."
@@ -1603,8 +1604,7 @@ ID-FORMAT valid values are `string' and `integer'."
       (tramp-file-name-user vec)
     (when-let ((localname
 		(tramp-get-connection-property
-		 (tramp-get-process vec) "share"
-		 (tramp-get-connection-property vec "default-location" nil))))
+		 (tramp-get-process vec) "share" nil)))
       (file-attribute-user-id
        (file-attributes (tramp-make-tramp-file-name vec localname) id-format)))))

@@ -1613,8 +1613,7 @@ ID-FORMAT valid values are `string' and `integer'."
 ID-FORMAT valid values are `string' and `integer'."
   (when-let ((localname
 	      (tramp-get-connection-property
-	       (tramp-get-process vec) "share"
-	       (tramp-get-connection-property vec "default-location" nil))))
+	       (tramp-get-process vec) "share" nil)))
     (file-attribute-group-id
      (file-attributes (tramp-make-tramp-file-name vec localname) id-format))))

diff --git a/lisp/tramp-sh.el b/lisp/tramp-sh.el
index 98192bd9..ea089224 100644
--- a/lisp/tramp-sh.el
+++ b/lisp/tramp-sh.el
@@ -1585,6 +1585,7 @@ ID-FORMAT valid values are `string' and `integer'."
       ;; Examine `file-attributes' cache to see if request can be
       ;; satisfied without remote operation.
       (or (tramp-check-cached-permissions v ?x)
+	  (tramp-check-cached-permissions v ?s)
 	  (tramp-run-test "-x" filename)))))

 (defun tramp-sh-handle-file-readable-p (filename)
diff --git a/lisp/tramp.el b/lisp/tramp.el
index 83437eaf..ceb7ab30 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -5434,7 +5434,8 @@ be granted."
         (offset (cond
                  ((eq ?r access) 1)
                  ((eq ?w access) 2)
-                 ((eq ?x access) 3))))
+                 ((eq ?x access) 3)
+                 ((eq ?s access) 3))))
     (dolist (suffix '("string" "integer") result)
       (setq
        result
@@ -5464,13 +5465,15 @@ be granted."
             ;; User accessible and owned by user.
             (and
              (eq access (aref (file-attribute-modes file-attr) offset))
-	     (or (equal remote-uid (file-attribute-user-id file-attr))
+	     (or (equal remote-uid unknown-id)
+		 (equal remote-uid (file-attribute-user-id file-attr))
 		 (equal unknown-id (file-attribute-user-id file-attr))))
             ;; Group accessible and owned by user's principal group.
             (and
              (eq access
 		 (aref (file-attribute-modes file-attr) (+ offset 3)))
-             (or (equal remote-gid (file-attribute-group-id file-attr))
+             (or (equal remote-gid unknown-id)
+		 (equal remote-gid (file-attribute-group-id file-attr))
 		 (equal unknown-id (file-attribute-group-id file-attr))))))))))))

 (defun tramp-get-remote-uid (vec id-format)

Reply via email to