From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8836 Path: news.gmane.org!not-for-mail From: Josiah Worcester Newsgroups: gmane.linux.lib.musl.general Subject: Re: [BUG] nl_langinfo returns NULL instead of empty string Date: Tue, 10 Nov 2015 20:42:40 +0000 Message-ID: References: <564252F1.5050307@email.cz> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c36b88c8b820052435c0eb X-Trace: ger.gmane.org 1447188189 16403 80.91.229.3 (10 Nov 2015 20:43:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Nov 2015 20:43:09 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8849-gllmg-musl=m.gmane.org@lists.openwall.com Tue Nov 10 21:43:05 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZwFkt-0000NM-FR for gllmg-musl@m.gmane.org; Tue, 10 Nov 2015 21:43:03 +0100 Original-Received: (qmail 13402 invoked by uid 550); 10 Nov 2015 20:43:01 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 13384 invoked from network); 10 Nov 2015 20:43:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-type; bh=vMg6I1uLSFjNj9YO88TY9m1Y65eLdzYwqp1L9I0BHJA=; b=BtLf7bK9dmBo5U81LoqMlCk8k3EWKj/4yd0YWkgSIihHEEnF1jfv8bZ0PO8Zg+YFPj SmU7GqQVclQbUm4OjnAkE+2CTypVd0QIW5jkz9iUHTnXjNgcl2f7slYu7SQTtTHBfMIb r8au/uu7s9+QsuBdQw0PY5sugq1kqZ7/nsaa2qPy0ndERLR7NFO2KrUt81Ifx0A0o19X /j1FlakR4unC+HPQzbl9vzInrGQjrZotz9OIzBtLXsxpSZ38ok4qZZEKZLgCzDJU63q5 jQ0zgYnWIEhXFIteGqOrzj3kZ4uOSKfosq9PRSQXjUmJYQm/BvHl0NCgeW1N5F1trIni SSEQ== X-Received: by 10.112.35.196 with SMTP id k4mr2742790lbj.3.1447188169798; Tue, 10 Nov 2015 12:42:49 -0800 (PST) In-Reply-To: <564252F1.5050307@email.cz> Xref: news.gmane.org gmane.linux.lib.musl.general:8836 Archived-At: --001a11c36b88c8b820052435c0eb Content-Type: text/plain; charset=UTF-8 On Tue, Nov 10, 2015 at 12:26 PM wrote: > Manual page for nl_langinfo() function says it should return an empty > string when 'item' is not valid. Musl's implementation currently returns > NULL. This is causing issue for applications compiled against glibc > using gnu extensions, such as 'GROUPING' (0x10002) item (which is > returning '\003\003' for glibc on my system, but NULL when using musl). > > One example of such application is 'Champions of Regnum' game. It is > crashing with musl, because it strncpy() a string returned from the > function. > POSIX agrees: http://pubs.opengroup.org/onlinepubs/9699919799/functions/nl_langinfo.html clearly states "In all locales, these functions shall return a pointer to an empty string if item contains an invalid setting." Good catch. --001a11c36b88c8b820052435c0eb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Tue, Nov 10= , 2015 at 12:26 PM <smidjar2.re= g@email.cz> wrote:
Manual p= age for nl_langinfo() function says it should return an empty
string when 'item' is not valid. Musl's implementation currentl= y returns
NULL. This is causing issue for applications compiled against glibc
using gnu extensions, such as 'GROUPING' (0x10002) item (which is returning '\003\003' for glibc on my system, but NULL when using mu= sl).

One example of such application is 'Champions of Regnum' game. It i= s
crashing with musl, because it strncpy() a string returned from the
function.

POSIX agrees: =C2=A0http://pubs.opengroup.org/onlinepubs/9699919799/functions/nl_langinfo.= html=C2=A0clearly states "In all locales, these functions shall re= turn a pointer to an empty string if item contains an invalid setting."= ;
Good catch.
--001a11c36b88c8b820052435c0eb--