From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Cc: "Philippe Grégoire" <pg@pgregoire.xyz>
Subject: Re: getspnam: errno=ENOENT for absent user
Date: Wed, 26 Dec 2018 13:29:17 +0100 [thread overview]
Message-ID: <20181226122917.GD21289@port70.net> (raw)
In-Reply-To: <b43e36e4f5b4d375342c848e6305f0d5@pgregoire.xyz>
* Philippe Grégoire <pg@pgregoire.xyz> [2018-12-25 17:07:14 -0500]:
> I'm working with saltstack on Alpine Linux and am getting trouble
> managing users. I tracked the problem down to musl and the fact
> that getspnam sets errno to ENOENT when a user is missing. This
> behavior differs from glibc which leaves errno to 0 and makes
> the user relies on the return value; when the name is missing.
>
> Semantically, ENOENT makes sense, but this is breaking compatibility
> with other softwares, at the moment. I'll send a patch over to
> saltstack so that current systems are supported, but believe it
> should be fixed here too for future compatibility. What do you think?
based on
http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwnam.html
"If the requested entry was not found, errno shall not be changed."
this should be fixed in musl.
>
> Please, Cc me for reply as I'm not subscribed.
>
>
> Program to demonstrate the issue:
>
> #include <errno.h>
> #include <shadow.h>
> #include <stdio.h>
> int main(void)
> {
> errno = 0;
> void* r = getspnam("enoent);
> perror("getspnam");
> printf("%p\n", r);
> }
>
> On Debian:
> getspnam: Success
> (nil)
>
> On Alpine:
> getspnam: No such file or directory
> 0
next prev parent reply other threads:[~2018-12-26 12:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-25 22:07 Philippe Grégoire
2018-12-26 12:29 ` Szabolcs Nagy [this message]
2018-12-26 15:47 ` Rich Felker
2018-12-28 22:00 ` Rich Felker
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=20181226122917.GD21289@port70.net \
--to=nsz@port70.net \
--cc=musl@lists.openwall.com \
--cc=pg@pgregoire.xyz \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).