From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28982 invoked by alias); 3 Nov 2011 20:49:06 -0000 Received: (qmail 28962 invoked by uid 22791); 3 Nov 2011 20:49:04 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from bosmailout07.eigbox.net (HELO bosmailout07.eigbox.net) (66.96.186.7) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Nov 2011 20:48:50 +0000 Received: from bosmailscan12.eigbox.net ([10.20.15.12]) by bosmailout07.eigbox.net with esmtp (Exim) id 1RM4DR-0004Na-3A for cygwin@cygwin.com; Thu, 03 Nov 2011 16:48:49 -0400 Received: from bosimpout01.eigbox.net ([10.20.55.1]) by bosmailscan12.eigbox.net with esmtp (Exim) id 1RM4DQ-0002xX-Eh for cygwin@cygwin.com; Thu, 03 Nov 2011 16:48:48 -0400 Received: from bosauthsmtp01.eigbox.net ([10.20.18.1]) by bosimpout01.eigbox.net with NO UCE id skoo1h00C01P9Sa01koo8j; Thu, 03 Nov 2011 16:48:48 -0400 X-EN-OrigOutIP: 10.20.18.1 X-EN-IMPSID: skoo1h00C01P9Sa01koo8j Received: from c-24-8-203-182.hsd1.co.comcast.net ([24.8.203.182] helo=laptop3) by bosauthsmtp01.eigbox.net with esmtpa (Exim) id 1RM4DQ-0005Si-Cp for cygwin@cygwin.com; Thu, 03 Nov 2011 16:48:48 -0400 From: "Leon Vanderploeg" To: Subject: Possible Bug (clarification) in Cygwin 1.7.5 -- findfirstfile (and findnextfile) yeild bad cfilename when file names have special characters. Works in cygwin 1.5, fails in 1.7 Date: Thu, 03 Nov 2011 20:49:00 -0000 Message-ID: <135801cc9a69$f73ceaf0$e5b6c0d0$@vaultnow.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-EN-UserInfo: ca4eb83b29c199dc675fd93de881b90e:2283ef65109048eed6984feda31515c6 X-EN-AuthUser: leonv@vaultnow.com X-EN-OrigIP: 24.8.203.182 X-EN-OrigHost: c-24-8-203-182.hsd1.co.comcast.net X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-11/txt/msg00045.txt.bz2 Greetings, This issue is making my head flat from pounding it against the wall. It ap= pears to be a bug in Cygwin 1.7, but I can't say with any certainty. I've = been down too many dead end trails already... With cygwin 1.7.5, cFileName with a special characters such as =C3=B1 (n wi= th tidle above it) fail be properly extracted from a WIN32_FIND_DATA struct= ure with findFirstFile (or findNextFile). To set up a simple test scenario, I created a file in C:\Testing named Ma= =C3=B1ana.docx. I compiled the code at the end of this message on Cygwin 1= .7.9 with GCC version 3.4.4 on Server 2008 32 bit system. On this system (= and on a Windows 7 32 bit machine), it returns: $ ./winfilestat3.exe hFind filename is ***Ma=E2=96=92ana.docx*** hFind file name stat return code is: -1 character 0 is M character 0 is signed int 77, hex 4d character 1 is a character 1 is signed int 97, hex 61 character 2 is =E2=96=92 character 2 is signed int -15, hex fffffff1 character 3 is a character 3 is signed int 97, hex 61 character 4 is n character 4 is signed int 110, hex 6e character 5 is a character 5 is signed int 97, hex 61 character 6 is . character 6 is signed int 46, hex 2e character 7 is d character 7 is signed int 100, hex 64 character 8 is o character 8 is signed int 111, hex 6f character 9 is c character 9 is signed int 99, hex 63 NOTE that the =C3=B1 is interpreted as =E2=96=92, and the stat fails. I moved the compiled program to an old Server 2003 running Cygwin 1.5.25. = It CORRECTLY returns: bash-3.2$ ./winfilestat3.exe hFind filename is ***Ma=C3=B1ana.docx*** hFind file name stat return code is: 0 character 0 is M character 0 is signed int 77, hex 4d character 1 is a character 1 is signed int 97, hex 61 character 2 is =C3=B1 character 2 is signed int -15, hex fffffff1 character 3 is a character 3 is signed int 97, hex 61 character 4 is n character 4 is signed int 110, hex 6e character 5 is a character 5 is signed int 97, hex 61 character 6 is . character 6 is signed int 46, hex 2e bash-3.2$ bash-3.2$=20 Note the =C3=B1 is correct, and the stat succeeds. Is this a bug, or do I need to set something up special on Cygwin 1.7 to ge= t it to work the way it used to? Thanks in advance, Leon **start of code**************************** #include #include #include #include #include =20 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct stat fileStat; WIN32_FIND_DATA FindFileData; HANDLE hFind; =09 int main(int argc, char **argv) { char filename[100]; int rtn, i; char chr; //find file char pathSearch[300]; sprintf(pathSearch, "C:\\Testing\\*.docx"); hFind =3D FindFirstFile(pathSearch, &FindFileData); if (hFind =3D=3D INVALID_HANDLE_VALUE) { printf("Warning: No .docx file found in the directory. Exiting.\n"); return(1); } strcpy(filename, FindFileData.cFileName); printf("hFind filename is ***%s***\n",filename); =09 rtn =3D stat(filename,&fileStat); printf("hFind file name stat return code is: %d\n", rtn); for ( i =3D 0 ; i < wcslen(filename) ; i++ ) { printf("character %d is %c\n", i, filename[i] ); printf("character %d is signed int %d, hex %x \n", i, filename[i], filen= ame[i] ); } return(0); } **end of code**************************** Leon Vanderploeg Cell 303-877-9654 -- 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