public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* nl_langinfo returning null?
@ 2010-04-09 20:25 Charles Wilson
  2010-04-09 21:16 ` Corinna Vinschen
  0 siblings, 1 reply; 6+ messages in thread
From: Charles Wilson @ 2010-04-09 20:25 UTC (permalink / raw)
  To: cygwin

I've noticed that bsdtar.exe has been coredumping occasionally. I've
tracked it down to a behavioral change in recent cygwin DLLs.  This line
in bsdtar.c:

          bsdtar->day_first = (*nl_langinfo(D_MD_ORDER) == 'd');

causes a segfault, because nl_langinfo returns null.  However, according
to POSIX:

http://www.opengroup.org/onlinepubs/009695399/functions/nl_langinfo.html:

"In a locale where langinfo data is not defined, nl_langinfo() shall
return a pointer to the corresponding string in the POSIX locale. In all
locales, nl_langinfo() shall return a pointer to an empty string if item
contains an invalid setting."

Now, this doesn't always happen; I only see it when I run bsdtar.exe in
mintty, but not if I run it in rxvt-unicode, rxvt, cmd/bash, ...

So, it seems to be a weird interaction with something mintty is doing,
and the i18n stuff, but...regardless, cygwin's nl_langinfo() should
never return null.

FWIW, I've put a workaround in bsdtar.c, and will be uploading a new
version shortly.

--
Chuck

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: nl_langinfo returning null?
  2010-04-09 20:25 nl_langinfo returning null? Charles Wilson
@ 2010-04-09 21:16 ` Corinna Vinschen
  2010-04-09 21:26   ` Corinna Vinschen
  0 siblings, 1 reply; 6+ messages in thread
From: Corinna Vinschen @ 2010-04-09 21:16 UTC (permalink / raw)
  To: cygwin

On Apr  9 16:24, Charles Wilson wrote:
> I've noticed that bsdtar.exe has been coredumping occasionally. I've
> tracked it down to a behavioral change in recent cygwin DLLs.  This line
> in bsdtar.c:
> 
>           bsdtar->day_first = (*nl_langinfo(D_MD_ORDER) == 'd');
> 
> causes a segfault, because nl_langinfo returns null.  However, according
> to POSIX:
> 
> http://www.opengroup.org/onlinepubs/009695399/functions/nl_langinfo.html:
> 
> "In a locale where langinfo data is not defined, nl_langinfo() shall
> return a pointer to the corresponding string in the POSIX locale. In all
> locales, nl_langinfo() shall return a pointer to an empty string if item
> contains an invalid setting."
> 
> Now, this doesn't always happen; I only see it when I run bsdtar.exe in
> mintty, but not if I run it in rxvt-unicode, rxvt, cmd/bash, ...
> 
> So, it seems to be a weird interaction with something mintty is doing,
> and the i18n stuff, but...regardless, cygwin's nl_langinfo() should
> never return null.

I just had a look into the __set_lc_time_from_win function which fills
in the time-related data returned by nl_langinfo.  For some reason I
missed to fill in the md_order data entirely *blush*.

> 
> FWIW, I've put a workaround in bsdtar.c, and will be uploading a new
> version shortly.

Please, don't.  I'll try to come up with a fix over the weekend and we
release Cygwin 1.7.5 soon, especially given the memory leak fix cgf
created today.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: nl_langinfo returning null?
  2010-04-09 21:16 ` Corinna Vinschen
@ 2010-04-09 21:26   ` Corinna Vinschen
  2010-04-10  0:05     ` Charles Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Corinna Vinschen @ 2010-04-09 21:26 UTC (permalink / raw)
  To: cygwin

On Apr  9 23:16, Corinna Vinschen wrote:
> On Apr  9 16:24, Charles Wilson wrote:
> > I've noticed that bsdtar.exe has been coredumping occasionally. I've
> > tracked it down to a behavioral change in recent cygwin DLLs.  This line
> > in bsdtar.c:
> > 
> >           bsdtar->day_first = (*nl_langinfo(D_MD_ORDER) == 'd');
> > 
> > causes a segfault, because nl_langinfo returns null.  However, according
> > to POSIX:
> > 
> > http://www.opengroup.org/onlinepubs/009695399/functions/nl_langinfo.html:
> > 
> > "In a locale where langinfo data is not defined, nl_langinfo() shall
> > return a pointer to the corresponding string in the POSIX locale. In all
> > locales, nl_langinfo() shall return a pointer to an empty string if item
> > contains an invalid setting."
> > 
> > Now, this doesn't always happen; I only see it when I run bsdtar.exe in
> > mintty, but not if I run it in rxvt-unicode, rxvt, cmd/bash, ...
> > 
> > So, it seems to be a weird interaction with something mintty is doing,
> > and the i18n stuff, but...regardless, cygwin's nl_langinfo() should
> > never return null.
> 
> I just had a look into the __set_lc_time_from_win function which fills
> in the time-related data returned by nl_langinfo.  For some reason I
> missed to fill in the md_order data entirely *blush*.
> 
> > 
> > FWIW, I've put a workaround in bsdtar.c, and will be uploading a new
> > version shortly.
> 
> Please, don't.  I'll try to come up with a fix over the weekend and we
> release Cygwin 1.7.5 soon, especially given the memory leak fix cgf
> created today.

Apparently I already created the md_order information, but I accidentally
neglected to set the md_order pointer to the value, so it remained NULL.
I just applied the one-line patch.  Can you please verify that it now
works for you?


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: nl_langinfo returning null?
  2010-04-09 21:26   ` Corinna Vinschen
@ 2010-04-10  0:05     ` Charles Wilson
  2010-04-10  5:15       ` Christopher Faylor
  2010-04-10  5:22       ` Charles Wilson
  0 siblings, 2 replies; 6+ messages in thread
From: Charles Wilson @ 2010-04-10  0:05 UTC (permalink / raw)
  To: Cygwin Mailing List

On 4/9/2010 5:26 PM, Corinna Vinschen wrote:
> Apparently I already created the md_order information, but I accidentally
> neglected to set the md_order pointer to the value, so it remained NULL.
> I just applied the one-line patch.  Can you please verify that it now
> works for you?

It's been a while since I built the DLL, but I'm pretty sure this isn't
right:

Making version.o and winver.o
/usr/src/devel/kernel/src/winsup/cygwin/mkvers.sh: line 48: [: 09,:
integer expression expected
Version 1.7.4-HEAD
/usr/src/devel/kernel/src/winsup/cygwin/winver.rc:43:26: error: macro
"STRINGIFY1" passed 2 arguments, but takes just 1
windres: /usr/src/devel/kernel/src/winsup/cygwin/winver.rc:43: syntax error
windres: preprocessing failed.
make[3]: *** [winver_stamp] Error 1


That was from a incremental build; I'll try again with a completely
fresh builddir...

--
Chuck

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: nl_langinfo returning null?
  2010-04-10  0:05     ` Charles Wilson
@ 2010-04-10  5:15       ` Christopher Faylor
  2010-04-10  5:22       ` Charles Wilson
  1 sibling, 0 replies; 6+ messages in thread
From: Christopher Faylor @ 2010-04-10  5:15 UTC (permalink / raw)
  To: cygwin

On Fri, Apr 09, 2010 at 08:05:00PM -0400, Charles Wilson wrote:
>On 4/9/2010 5:26 PM, Corinna Vinschen wrote:
>> Apparently I already created the md_order information, but I accidentally
>> neglected to set the md_order pointer to the value, so it remained NULL.
>> I just applied the one-line patch.  Can you please verify that it now
>> works for you?
>
>It's been a while since I built the DLL, but I'm pretty sure this isn't
>right:
>
>Making version.o and winver.o
>/usr/src/devel/kernel/src/winsup/cygwin/mkvers.sh: line 48: [: 09,:
>integer expression expected
>Version 1.7.4-HEAD
>/usr/src/devel/kernel/src/winsup/cygwin/winver.rc:43:26: error: macro
>"STRINGIFY1" passed 2 arguments, but takes just 1
>windres: /usr/src/devel/kernel/src/winsup/cygwin/winver.rc:43: syntax error
>windres: preprocessing failed.
>make[3]: *** [winver_stamp] Error 1
>
>That was from a incremental build; I'll try again with a completely
>fresh builddir...

I've uploaded a fresh snapshot.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: nl_langinfo returning null?
  2010-04-10  0:05     ` Charles Wilson
  2010-04-10  5:15       ` Christopher Faylor
@ 2010-04-10  5:22       ` Charles Wilson
  1 sibling, 0 replies; 6+ messages in thread
From: Charles Wilson @ 2010-04-10  5:22 UTC (permalink / raw)
  To: Cygwin Mailing List

On 4/9/2010 8:05 PM, Charles Wilson wrote:

> Making version.o and winver.o
> /usr/src/devel/kernel/src/winsup/cygwin/mkvers.sh: line 48: [: 09,:

Still had some odd problems with mkvers.sh (`date` output format may
have changed? The day ($3) includes a comma, which doesn't parse as a
number "09,"...)

But, after working around that: Yes, the coredump issue with
(unmodified) bsdtar is now gone.

--
Chuck

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

end of thread, other threads:[~2010-04-10  5:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-09 20:25 nl_langinfo returning null? Charles Wilson
2010-04-09 21:16 ` Corinna Vinschen
2010-04-09 21:26   ` Corinna Vinschen
2010-04-10  0:05     ` Charles Wilson
2010-04-10  5:15       ` Christopher Faylor
2010-04-10  5:22       ` Charles Wilson

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 read-only IMAP folder(s) and NNTP newsgroup(s).