delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/04/09/17:26:52

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 9 Apr 2010 23:26:41 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: nl_langinfo returning null?
Message-ID: <20100409212640.GJ28908@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4BBF8D1B DOT 3010203 AT cwilson DOT fastmail DOT fm> <20100409211634 DOT GI28908 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20100409211634.GI28908@calimero.vinschen.de>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019