tramp-parse-passwd does not seem to work if getent is available?

Tim Landscheidt <[email protected]>
Newsgroups gmane.emacs.tramp
Organization https://www.tim-landscheidt.de/
Message-ID <[email protected]>
Hi,

I was playing around with some of TRAMP's internals
(2.5.4-pre as part of GNU Emacs 28.3) and noticed:

| ELISP> (tramp-parse-passwd "/etc/passwd")
| (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)

| ELISP>

Curiously, I then executed the alternative branch in
tramp-parse-passwd that would get called if the getent exe-
cutable is not available:

| ELISP> (tramp-parse-file "/etc/passwd" #'tramp-parse-passwd-group)
| (("root" "localhost")
|  ("bin" "localhost")
|  ("daemon" "localhost")
|  ("adm" "localhost")
|  […])

| ELISP>

Looking at the code:

| (defun tramp-parse-passwd (filename)
|   "Return a list of (user host) tuples allowed to access.
| Host is always \"localhost\"."
|   (with-tramp-connection-property nil "parse-passwd"
|     (if (executable-find "getent")
|         (with-temp-buffer
|           (when (zerop (tramp-call-process nil "getent" nil t nil "passwd"))
|             (goto-char (point-min))
|             (cl-loop while (not (eobp)) collect
|                      (tramp-parse-etc-group-group))))
|       (tramp-parse-file filename #'tramp-parse-passwd-group))))

it is not clear to me why the output of "getent passwd" and
the contents of /etc/passwd are parsed differently.
Shouldn't the output of "getent passwd" (and its other vari-
ants) be of the same structure as /etc/passwd?

Tim
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.