Mail Archives: cygwin/2009/05/08/15:39:30
On May 9 04:21, IWAMURO Motonori wrote:
> 2009/5/9 Corinna Vinschen <corinna-cygwin AT cygwin DOT com>:
> > can't see a fault in Cygwin. Neither from strace, nor in a GDB session.
> > The readdir calls return the filenames using the SO sequences so that
> > a valid byte-stream is created which also works in the C locale.
> > However, for some reason there's a EILSEQ (138) errno generated, but
> > from what I can tell it's not generated in Cygwin or newlib code.
>
> I think that I found Cygwin-1.7's bug.
>
> > int bytes = f_wctomb (_REENT, buf, pw, charset, &ps);
>
> f_wctomb is __ascii_wctomb when not using setlocale(LC_CTYPE).
> If return value of __ascii_wctomb == -1, errno == EILSEQ.
>
> I think that it is necessary to reset errno after wctomb.
>
> --- a/winsup/cygwin/strfuncs.cc Thu May 07 12:29:17 2009 +0900
> +++ b/winsup/cygwin/strfuncs.cc Sat May 09 04:01:33 2009 +0900
> @@ -432,6 +432,7 @@
> ASCII SO; UTF-8 representation of invalid char. */
> if (bytes == -1 && *charset != 'U'/*TF-8*/)
> {
> + errno = 0;
> buf[0] = 0x0e; /* ASCII SO */
> bytes = __utf8_wctomb (_REENT, buf + 1, pw, charset, &ps);
> if (bytes == -1)
Cool. Thanks for the patch. This actually solves the problem.
I applied the patch with just a little tweak.
Nevertheless, it looks like python has a problem as well. Why does it
check an errno if the functions returned successfully? That doesn't
sound right to me.
Thanks again,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -