delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/10/25/09:07:37

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-EN-OrigOutIP: 10.20.18.2
X-EN-IMPSID: p1731h00j02gpmq01173pP
From: "Leon Vanderploeg" <leonv AT vaultnow DOT com>
To: <cygwin AT cygwin DOT com>
Cc: <leonv AT vaultnow DOT com>
Subject: possible bug in stat() -- not working with special characters on 64 bit systems
Date: Tue, 25 Oct 2011 07:06:53 -0600
Message-ID: <133e01cc9316$fbc5ce70$f3516b50$@vaultnow.com>
MIME-Version: 1.0
X-EN-UserInfo: ca4eb83b29c199dc675fd93de881b90e:2283ef65109048eed6984feda31515c6
X-EN-AuthUser: leonv AT vaultnow DOT 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 AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id p9PD7XfN003538

I have been fighting a problem with a compiled C program and seem to have
narrowed it down.  When file names contain special characters such as the n
with the tilde above it (ñ), stat() works fine on 32 bit machines, but fails
on 64 bit machines (both windows 7 and server 2008 R2).  

At the end of the this email is source code of a small test program to
demonstrate the issue.  Of course, the C:\ directory must contain the
Mañana.doc and Manana.doc files.  I can provide a compiled version if
needed.  The program is compiled on Cygwin version 1.5.25, GCC version
3.4.4.

On 32 bit machines, stat() succeeds for both files, on 64 bit machines, the
stat() of Manana.doc  succeeds but Mañana.doc fails.

Can someone please test and confirm if this is, indeed, a bug?

Thanks,
Leon V

*************start of source code****************************
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
#include <winbase.h>
#include <sys/types.h>
#include <fcntl.h>
#include <dirent.h>
#include <curl/curl.h>
#include <pthread.h>

#include <sys/wait.h>
#include <cygwin/wait.h>

int main(int argc, char **argv)
{
	char filename[100];
	int rtn;
	
	strcpy(filename, "C:\\Mañana.doc");
	printf("filename is ***%s***\n",filename);
	struct stat fileStat;
	rtn = stat(filename,&fileStat);
	printf("stat return code is: %d\n", rtn);
	
	strcpy(filename, "C:\\Manana.doc");
	printf("filename is ***%s***\n",filename);
	rtn = stat(filename,&fileStat);
	printf("stat return code is: %d\n", rtn);
	return(0);
}

*************end of source code*****************************



--
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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019