mailing list of musl libc
 help / color / mirror / code / Atom feed
* [BUG] nl_langinfo returns NULL instead of empty string
@ 2015-11-10 20:26 smidjar2.reg
  2015-11-10 20:42 ` Josiah Worcester
  2015-11-11  4:10 ` Rich Felker
  0 siblings, 2 replies; 3+ messages in thread
From: smidjar2.reg @ 2015-11-10 20:26 UTC (permalink / raw)
  To: musl

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] nl_langinfo returns NULL instead of empty string
  2015-11-10 20:26 [BUG] nl_langinfo returns NULL instead of empty string smidjar2.reg
@ 2015-11-10 20:42 ` Josiah Worcester
  2015-11-11  4:10 ` Rich Felker
  1 sibling, 0 replies; 3+ messages in thread
From: Josiah Worcester @ 2015-11-10 20:42 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 811 bytes --]

On Tue, Nov 10, 2015 at 12:26 PM <smidjar2.reg@email.cz> 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.

[-- Attachment #2: Type: text/html, Size: 1248 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] nl_langinfo returns NULL instead of empty string
  2015-11-10 20:26 [BUG] nl_langinfo returns NULL instead of empty string smidjar2.reg
  2015-11-10 20:42 ` Josiah Worcester
@ 2015-11-11  4:10 ` Rich Felker
  1 sibling, 0 replies; 3+ messages in thread
From: Rich Felker @ 2015-11-11  4:10 UTC (permalink / raw)
  To: musl

On Tue, Nov 10, 2015 at 09:26:25PM +0100, smidjar2.reg@email.cz 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.

Thanks! Fixed by commit a946e8117ed51dd771bd8cac3575fc28a0399a32.

Rich


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-11  4:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10 20:26 [BUG] nl_langinfo returns NULL instead of empty string smidjar2.reg
2015-11-10 20:42 ` Josiah Worcester
2015-11-11  4:10 ` Rich Felker

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).