X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_42,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <20090508193905.GO21324@calimero.vinschen.de> 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> <20090508193905 DOT GO21324 AT calimero DOT vinschen DOT de> Date: Sat, 9 May 2009 05:02:49 +0900 Message-ID: <3f0ad08d0905081302p12091827r44e99f04c067df9f@mail.gmail.com> Subject: Re: [1.7][python] File operation API to multibyte filenames fails. From: IWAMURO Motonori To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 2009/5/9 Corinna Vinschen : > Cool. Thanks for the patch. This actually solves the problem. > I applied the patch with just a little tweak. Thanks. The following patch might be better. --- a/winsup/cygwin/strfuncs.cc Thu May 07 12:29:17 2009 +0900 +++ b/winsup/cygwin/strfuncs.cc Sat May 09 04:39:49 2009 +0900 @@ -427,7 +427,9 @@ path names) is transform_chars in path.cc. */ if ((pw & 0xff00) =3D=3D 0xf000) pw &=3D 0xff; + int eno =3D errno; int bytes =3D f_wctomb (_REENT, buf, pw, charset, &ps); + errno =3D eno; /* Convert chars invalid in the current codepage to a sequence ASCII SO; UTF-8 representation of invalid char. */ if (bytes =3D=3D -1 && *charset !=3D 'U'/*TF-8*/) > Nevertheless, it looks like python has a problem as well. =A0Why does it > check an errno if the functions returned successfully? =A0That doesn't > sound right to me. When the last readdir returns NULL, python detects the error because readdir keeps previous errno. 1) ep =3D readdir(dirp); // ep->d_name =3D=3D ".", errno =3D=3D 0 Python check only ep !=3D NULL. -> OK 2) ep =3D readdir(dirp); // ep->d_name =3D=3D "..", errno =3D=3D 0 Python check only ep !=3D NULL. -> OK 3) ep =3D readdir(dirp); // ep->d_name =3D=3D "\xe3\x82...", errno =3D=3D 1= 38 Python check only ep !=3D NULL. -> OK 4) ep =3D readdir(dirp); // ep->d_name =3D=3D "\xe3\x83...", errno =3D=3D 1= 38 Python check only ep !=3D NULL. -> OK 5) ep =3D readdir(dirp); // ep =3D=3D NULL, errno =3D=3D 138 Python check ep =3D=3D NULL and errno !=3D 0. -> Fail! --=20 IWAMURO Motnori -- 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/