This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [SECURITY] libidn - locale specific error in test suite


On 01/19/2017 03:02 PM, Corinna Vinschen wrote:
>>>> After stepping through a debugger, it looks like this is a bug in gnulib
>>>> and not cygwin.  Gnulib is trying to test that its own function
>>>> gl_locale_name() can track the use of uselocale() to set a thread-local
>>>> locale that overrides the global locale.

>> nl_langinfo_l(NL_LOCALE_NAME(LC_MESSAGES), locale);
>>
>> to recover the name of the LC_MESSAGES portion of the locale object.
>>
>> As Cygwin lacks that macro, there is NO way to access the locale name of
>> what went into constructing a thread-local locale without peeking into
>> the internal guts of the opaque locale_t object.
> 
> Question: Why is that needed outside of testcases?  If you called
> newlocale you know how it has been constructed.  The info should be
> available.  I have no problems to take glibc emulating stuff, but is
> there a real-world example?

Yes. Consider a library-writer that wants to do something in the correct
locale.  Here, you have a logical separation from the main app that
calls newlocale()/uselocale() and the library code that now wants to
reconstruct what the current locale is.  So being able to reconstruct
the names of the thread-local locale via gl_locale_name() makes the
library less coupled to the main app's setup.  In particular, at least
gettext wants to use it.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]