acheam changed the topic of #kisslinux to: Unnofficial KISS Linux community channel | | post logs or else | song of the day
ERROR_404_NULL has quit [Quit: WeeChat 4.0.2]
disapper3nce has joined #kisslinux
disapper3nce has quit [Client Quit]
solaare has quit [Ping timeout: 246 seconds]
solaare has joined #kisslinux
Hughmann has joined #kisslinux
Hughmann has quit [Quit: Client closed]
Hughmann has joined #kisslinux
Hughmann has quit [Client Quit]
disapper3nce has joined #kisslinux
disapper3nce has quit [Client Quit]
sad_plan has quit [Quit: nyaa~]
an3223 has quit [Remote host closed the connection]
an3223 has joined #kisslinux
traidare has joined #kisslinux
traidare has quit [Read error: Connection reset by peer]
traidare2 has joined #kisslinux
traidare2 is now known as traidare
schillingklaus has joined #kisslinux
schillingklaus has quit [Quit: schillingklaus]
traidare has quit [Ping timeout: 244 seconds]
traidare has joined #kisslinux
<ehawkvu> is anyone aware of an easier/more portable way to get a username from a uid?
<ehawkvu> I'm wanting to use uid's in my kiss fork, since they are easier to work w/
<ehawkvu> all I've come up with so far is this:
<ehawkvu> getent passwd | awk -F":" '$3 ~ /^<uid>$/ {print $1}'
<ehawkvu> I did see that it is possible to get the username using 'id'
<ehawkvu> but the command does not work on busybox, even though it works on ubase & gnucoreutils
<ehawkvu> also include toybox in that list
<ehawkvu> the command is "id -un 0"
<phoebos> does lisp not have a getpwnam(3) wrapper or equivalent?
<phoebos> both getent and that use of id aren't POSIX
<phoebos> if you can't do it in lisp, I would write a short (and portable) program in C
<phoebos> if you want, you could just parse /etc/passwd, which will work 99% of the time
<ehawkvu> I'm using *emacs lisp*, which in hindsight was possibly a bad move? should be easy to port over though
<ehawkvu> I think I'm just going to parse /etc/passwd, since like you said it's
<ehawkvu> almost guaranteed to work
<midfavila`> it should be trivial to extract using extended regex in elisp
<midfavila`> i've only done a little bit of work with it though so i won't try and provide code
<midfavila`> just a suggestion for a jump-off
<phoebos> sounds good
<phoebos> that's all getpwnam does anyway
<ehawkvu> not the prettiest impl, but it works
<ehawkvu> phoebos: how is bliss coming along?
traidare has quit [Ping timeout: 248 seconds]
traidare has joined #kisslinux
<phoebos> ehawkvu: I've been preoccupied so haven't worked on it for a few weeks.
<illiliti> /etc/passwd is not portable either
<illiliti> see nss if you wonder why
<illiliti> strictly speaking there is no simple portable way
<illiliti> that's something posix need to fix actually
<ehawkvu> On the upside, the 3 systems that I care about (linux, freebsd, and openbsd) all have the same /etc/passwd format
<ehawkvu> I'm surprised that it isn't standard as of yet
<ehawkvu> (the way to retrieve the info, not /etc/passwd)
<illiliti> all these systems support nss in more-or-less way, so /etc/passwd won't work
traidare has quit [Ping timeout: 246 seconds]
<illiliti> ... no matter which format it has. I would rather use non-portable getent utility than deal with this tbh
<illiliti> because getent is guaranteed to work. parsing /etc/passwd by hand - never
<midfavila`> can also just target unix systems specifically instead of posix autism
<illiliti> unix systems support nss since ages
<illiliti> and/or nscd
<illiliti> i'm gonna investigate what options would be suitable for posix standardization
<illiliti> the first obvious option is id -un <id>, but I afraid we lost it since its behavior varies between implementations. some of them always expect username(as standard says), so mandating that id should be supported would be breaking change
<illiliti> i believe that simplest option would adding a new flag to id to treat username as uid.
<illiliti> that would allow implementations to implement new behavior while not breaking current
<illiliti> but another flag means another decade to actually become portable
sad_plan has joined #kisslinux
<sad_plan> hi