Michael Albinus <[email protected]> writes:

> Better suited seems to be stat, which returns "UNKNOWN":
>
> # stat -c "%U %G" xxx
> UNKNOWN UNKNOWN
>
> So I will add this as alternative to `tramp-get-remote-uid' and
> `tramp-get-remote-gid'.

Well, I've committed the following patch to the repositories, which
should fix this:

--8<---------------cut here---------------start------------->8---
*** 
/home/albinus/src/tramp/lisp/tramp-sh.el.~3b182d0b508308d40d07b14fff22f48e44c70465~
 2014-11-01 17:50:08.706595545 +0100
--- /home/albinus/src/tramp/lisp/tramp-sh.el    2014-11-01 17:24:57.668587920 
+0100
***************
*** 5289,5305 ****
  
  (defun tramp-get-remote-uid (vec id-format)
    (with-tramp-connection-property vec (format "uid-%s" id-format)
!     (let ((res (cond
!               ((tramp-get-remote-id vec)
!                (tramp-get-remote-uid-with-id vec id-format))
!               ((tramp-get-remote-perl vec)
!                (tramp-get-remote-uid-with-perl vec id-format))
!               ((tramp-get-remote-python vec)
!                (tramp-get-remote-uid-with-python vec id-format))
!               (t (tramp-error
!                   vec 'file-error "Cannot determine remote uid")))))
!       ;; The command might not always return a number.
!       (if (and (equal id-format 'integer) (not (integerp res))) -1 res))))
  
  (defun tramp-get-remote-gid-with-id (vec id-format)
    (tramp-send-command-and-read
--- 5289,5308 ----
  
  (defun tramp-get-remote-uid (vec id-format)
    (with-tramp-connection-property vec (format "uid-%s" id-format)
!     (let ((res
!          (ignore-errors
!            (cond
!             ((tramp-get-remote-id vec)
!              (tramp-get-remote-uid-with-id vec id-format))
!             ((tramp-get-remote-perl vec)
!              (tramp-get-remote-uid-with-perl vec id-format))
!             ((tramp-get-remote-python vec)
!              (tramp-get-remote-uid-with-python vec id-format))))))
!       ;; Ensure there is a valid result.
!       (cond
!        ((and (equal id-format 'integer) (not (integerp res))) -1)
!        ((and (equal id-format 'string) (not (stringp res))) "UNKNOWN")
!        (t res)))))
  
  (defun tramp-get-remote-gid-with-id (vec id-format)
    (tramp-send-command-and-read
***************
*** 5330,5346 ****
  
  (defun tramp-get-remote-gid (vec id-format)
    (with-tramp-connection-property vec (format "gid-%s" id-format)
!     (let ((res (cond
!               ((tramp-get-remote-id vec)
!                (tramp-get-remote-gid-with-id vec id-format))
!               ((tramp-get-remote-perl vec)
!                (tramp-get-remote-gid-with-perl vec id-format))
!               ((tramp-get-remote-python vec)
!                (tramp-get-remote-gid-with-python vec id-format))
!               (t (tramp-error
!                   vec 'file-error "Cannot determine remote gid")))))
!       ;; The command might not always return a number.
!       (if (and (equal id-format 'integer) (not (integerp res))) -1 res))))
  
  ;; Some predefined connection properties.
  (defun tramp-get-inline-compress (vec prop size)
--- 5333,5352 ----
  
  (defun tramp-get-remote-gid (vec id-format)
    (with-tramp-connection-property vec (format "gid-%s" id-format)
!     (let ((res
!          (ignore-errors
!            (cond
!             ((tramp-get-remote-id vec)
!              (tramp-get-remote-gid-with-id vec id-format))
!             ((tramp-get-remote-perl vec)
!              (tramp-get-remote-gid-with-perl vec id-format))
!             ((tramp-get-remote-python vec)
!              (tramp-get-remote-gid-with-python vec id-format))))))
!       ;; Ensure there is a valid result.
!       (cond
!        ((and (equal id-format 'integer) (not (integerp res))) -1)
!        ((and (equal id-format 'string) (not (stringp res))) "UNKNOWN")
!        (t res)))))
  
  ;; Some predefined connection properties.
  (defun tramp-get-inline-compress (vec prop size)
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.

_______________________________________________
Tramp-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/tramp-devel

Reply via email to