X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Fri, 8 May 2009 21:39:05 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: [1.7][python] File operation API to multibyte filenames fails. Message-ID: <20090508193905.GO21324@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <3f0ad08d0905080602s36a9eddg852eaa3ea3a2a69f AT mail DOT gmail DOT com> <20090508130901 DOT GL21324 AT calimero DOT vinschen DOT de> <3f0ad08d0905080621j2b1f97b9p317ee1df0f1dfc76 AT mail DOT gmail DOT com> <20090508160415 DOT GM21324 AT calimero DOT vinschen DOT de> <3f0ad08d0905081221s670f165ap507d74f129954579 AT mail DOT gmail DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3f0ad08d0905081221s670f165ap507d74f129954579@mail.gmail.com> 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 May 9 04:21, IWAMURO Motonori wrote: > 2009/5/9 Corinna Vinschen : > > 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/