X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Mon, 20 Jul 2009 13:42:40 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com, newlib AT sources DOT redhat DOT com Subject: Re: mbrtowc bug Message-ID: <20090720114240.GB30066@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com, newlib AT sources DOT redhat DOT com References: <4A6451C0 DOT 9050504 AT byu DOT net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A6451C0.9050504@byu.net> User-Agent: Mutt/1.5.19 (2009-02-20) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 Jul 20 05:15, Eric Blake wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > The gnulib unit tests are declaring that cygwin's mbrtowc is broken. STC: > > #include > #include > #include > int main () > { > if (setlocale (LC_ALL, "ja_JP.eucJP") != NULL) > { > char input[] = "B\217\253\344\217\251\316er"; > > mbstate_t state; > wchar_t wc; > > memset (&state, '\0', sizeof (mbstate_t)); > if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) > { > input[1] = '\0'; > if (mbrtowc (&wc, input + 2, 5, &state) != 2) > return 1; > } > } > return 0; > } > > > According to Bruno Haible[1], the bug is in the __eucjp_wctomb and > __eucjp_mbtowc implementations. > > [1] http://lists.gnu.org/archive/html/bug-gnulib/2009-07/msg00051.html I'm a bit disappointed that, when looking into the sources anyway, why nobody provides a patch, rather then let me go through the whole test again. Sigh. Here's another problem: Bruno is wrong. Cygwin has it's own implementation of __eucjp_wctomb and __eucjp_mbtowc in winsup/cygwin/strfunc.cc, using the underlying Windows functions WideCharToMultiByte/MultiByteToWideChar. The newlib functions don't need to be rewritten. Thanks all the same for the testcase. 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