Github messages for voidlinux
 help / color / mirror / Atom feed
From: loreb <loreb@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: "sudo logname" should return my username instead of "root"
Date: Sun, 25 Jul 2021 21:49:24 +0200	[thread overview]
Message-ID: <20210725194924.UvbkaR_LGIraxzZT58GnfnrqXCp72bk6t_WLcMqkOPI@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-32185@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]

New comment by loreb on void-packages repository

https://github.com/void-linux/void-packages/issues/32185#issuecomment-886249014

Comment:
POSIX says that "The login name shall be the string that would be returned by the getlogin() function", so that's it.

One could argue that musl implements getlogin incorrectly - "a string containing the user name associated by the login activity with the controlling terminal of the current process" looks to me like they don't care if you ran sudo or equivalent, but rather only what you logged in as; I hope to be wrong here, because if I'm running anything as root I'd expect getlogin & friends to say I'm root.

That being said, I'm not a POSIX lawyer, so...
- linux: unclear
- openbsd: "This is true even if some of those processes assume another user ID, for example when su(1) is used"
- freebsd/netbsd: same as openbsd
- illumos (https://illumos.org/man/3c/getlogin) uses utmpx, similar to IBM
... so overall I suppose this is a bug in musl's implementation of getlogin,
but as they intentionally don't implement the utmp functions I'm not sure how to fix that.

  parent reply	other threads:[~2021-07-25 19:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-25  3:44 [ISSUE] " rivanfebrian123
2021-07-25  3:57 ` ericonr
2021-07-25  4:06 ` rivanfebrian123
2021-07-25  5:43 ` ericonr
2021-07-25 19:49 ` loreb [this message]
2021-07-25 20:15 ` ericonr
2021-07-25 20:56 ` loreb
2021-07-25 23:59 ` rivanfebrian123
2021-07-26  1:09 ` ericonr
2021-07-26 12:07 ` fosslinux
2021-07-26 12:08 ` fosslinux
2021-08-02 14:03 ` loreb
2021-08-03  0:26 ` rivanfebrian123
2021-08-03  3:00 ` ericonr
2021-08-03 10:28 ` rivanfebrian123
2021-08-03 10:31 ` rivanfebrian123
2021-08-03 10:33 ` rivanfebrian123
2021-08-03 13:59 ` ericonr
2021-08-03 13:59 ` [ISSUE] [CLOSED] " ericonr
2021-08-03 13:59 ` ericonr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210725194924.UvbkaR_LGIraxzZT58GnfnrqXCp72bk6t_WLcMqkOPI@z \
    --to=loreb@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).