From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13565 Path: news.gmane.org!.POSTED!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: getspnam: errno=ENOENT for absent user Date: Wed, 26 Dec 2018 13:29:17 +0100 Message-ID: <20181226122917.GD21289@port70.net> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1545827248 29713 195.159.176.226 (26 Dec 2018 12:27:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Dec 2018 12:27:28 +0000 (UTC) User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Philippe =?utf-8?B?R3LDqWdvaXJl?= To: musl@lists.openwall.com Original-X-From: musl-return-13581-gllmg-musl=m.gmane.org@lists.openwall.com Wed Dec 26 13:27:24 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1gc8HT-0007YL-7P for gllmg-musl@m.gmane.org; Wed, 26 Dec 2018 13:27:23 +0100 Original-Received: (qmail 32630 invoked by uid 550); 26 Dec 2018 12:29:31 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 32608 invoked from network); 26 Dec 2018 12:29:30 -0000 Mail-Followup-To: musl@lists.openwall.com, Philippe =?utf-8?B?R3LDqWdvaXJl?= Content-Disposition: inline In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:13565 Archived-At: * Philippe Gr=C3=A9goire [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. >=20 > 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. >=20 > Please, Cc me for reply as I'm not subscribed. >=20 >=20 > Program to demonstrate the issue: >=20 > #include > #include > #include > int main(void) > { > errno =3D 0; > void* r =3D getspnam("enoent); > perror("getspnam"); > printf("%p\n", r); > } >=20 > On Debian: > getspnam: Success > (nil) >=20 > On Alpine: > getspnam: No such file or directory > 0