This is the mail archive of the cygwin 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: Bug in libiconv?


On 2/2/2011 4:19 PM, Corinna Vinschen wrote:
> On Feb  2 19:58, Bruno Haible wrote:
>> charset.alias is requested on Linux, even though it normally does not exist,
>> so that packagers and users have a chance to modify the behaviour.
> 
> I beg to keep this choice to Cygwin users as well.  It will be empty by
> default as well.  The supported codesets are documented in
> http://cygwin.com/cygwin-ug-net/setup-locale.html#setup-locale-charsetlist
> If some weird alias is required, the user can add it to charset.alias.
> That's the optimal solution.

FWIW, using a fresh git clone of libiconv

	3cdff14a3cc549dc4ccfe02dca46e73b1e7a68c6
	Sat Jan 29 18:34:14 2011 +0100)

bootstrapped using a fresh gnulib

	a036b7684f9671ee53999773785d1865603c3849
	Tue Feb 1 10:04:17 2011 -0800

and no other patches, libiconv + cygwin-1.7.7 [note: NOT 1.7.8pre]
works, passes its own self-tests, and passes Corinna's original test
case that spawned this thread.

Bruno's change in libiconv was:

-         This is also the case on native Woe32 systems.  */
-#if __STDC_ISO_10646__ || ((defined _WIN32 || defined __WIN32__) &&
!defined __CYGWIN__)
+         This is also the case on native Woe32 systems and Cygwin >=
1.7, where
+         we know that it is UTF-16.  */
+#if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) ||
(defined __CYGWIN__ && CYGWIN_VERSION_DLL_MAJOR >= 1007)
...some code...
+#elif __STDC_ISO_10646__
...other code...
#endif

repeated at various places. Obviously the use of
CYGWIN_VERSION_DLL_MAJOR means there is a

+#ifdef __CYGWIN__
+#include <cygwin/version.h>
+#endif

in there, too.


Now, this configuration does NOT include:

  1) Corinna's suggested change to localcharset.c that modified
     get_charset_alias() to use charset.alias on cygwin instead of
     hardcoding the alias list, NOR the change in that file to
     locale_charset() to deal with copying the value returned by
     nl_langinfo() and remove some special cygwin workarounds involving
     GetACP().

  2) the relocation changes to avoid deprecated path conversion
     functions and to do things on cygwin "the linux way".
     http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00522.html

I tested both with and without --enable-relocatable...


>> But such a user will then write a mail to a mailing list, and it will take
>> time for me (or someone else) to investigate and answer it. By writing
>>   #if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
>> I avoid this potential problem.
> 
> Ok.  However, the other variation
> 
>    #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
> 
> should be only used in very rare circumstances.  Usually it just means
> that some unnecessary Windowism is used on Cygwin, and that there's
> probably a POSIXy equivalent.  If not, kick us here on the list and
> we can discuss it.

See above, with the

#if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) ||
(defined __CYGWIN__ && CYGWIN_VERSION_DLL_MAJOR >= 1007)

formulation.  It's not an erroneous use of a windowism, it just reflects
that cygwin's unicode impl shares characteristics with the underlying
win32 unicode support.


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


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