From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13564 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Philippe_Gr=C3=A9goire?= Newsgroups: gmane.linux.lib.musl.general Subject: getspnam: errno=ENOENT for absent user Date: Tue, 25 Dec 2018 17:07:14 -0500 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1545796959 5267 195.159.176.226 (26 Dec 2018 04:02:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Dec 2018 04:02:39 +0000 (UTC) User-Agent: Roundcube Webmail/1.1.2 To: musl@lists.openwall.com Original-X-From: musl-return-13580-gllmg-musl=m.gmane.org@lists.openwall.com Wed Dec 26 05:02:35 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 1gc0Ow-0001H8-P2 for gllmg-musl@m.gmane.org; Wed, 26 Dec 2018 05:02:34 +0100 Original-Received: (qmail 21618 invoked by uid 550); 26 Dec 2018 04:04:43 -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 25979 invoked from network); 25 Dec 2018 22:07:26 -0000 X-Sender: pg@pgregoire.xyz Xref: news.gmane.org gmane.linux.lib.musl.general:13564 Archived-At: Hi, 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? Please, Cc me for reply as I'm not subscribed. Program to demonstrate the issue: #include #include #include 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