[Top][All Lists]

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

Re: No POSIX "id" command, but have "gid" - how to use that?

From: Skip Montanaro
Subject: Re: No POSIX "id" command, but have "gid" - how to use that?
Date: Wed, 24 Sep 2014 11:19:59 -0500

On Tue, Sep 23, 2014 at 10:57 PM, Yuji Yamano <address@hidden> wrote:
The code is taken from emacs 24.3. I guess getting the function from
lisp/net/tramp-cmds.el in 24.2 and replacing "id" with "gid" work.

Thanks. I eventually got the 24.2 emacs-el package loaded on my box and modified tramp-get-remote-id like so:

(defun tramp-get-remote-id (vec)
  (with-connection-property vec "id"
    (tramp-message vec 5 "Finding POSIX `id' command")
     (catch 'id-found
       (let (dl name names result)
(setq names '("id" "gid"))
(while names
  (setq name (car names))
  (setq dl (tramp-get-remote-path vec))
  (while (and dl
      (setq result (tramp-find-executable vec name dl t t)))
    ;; Check POSIX parameter.
    (when (tramp-send-command-and-check vec (format "%s -u" result))
      (throw 'id-found result))
    (setq dl (cdr dl)))
  (setq names (cdr names)))))
     (tramp-error vec 'file-error "Couldn't find a POSIX `id' command"))))

I'm not sure it's worthy of a modification to tramp, though I will note that many people install the GNU version of various commands with a "g" prefix, so maybe with a small amount of refactoring all the other tramp-get-remote-* functions could be modified to call a helper function which tries g-NAME after NAME.

(Apologies for the HTML mail. It's impossible to read code in Gmail without making the code text fixed width.)


reply via email to

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