From: Georg N. <ge...@ro...> - 2007-08-27 15:04:17
|
On Aug 24, 2007, at 20:34, Greg Chicares wrote: > On 2007-08-24 23:43Z, Georg Nikodym wrote: > [...] >>> (The annoying problem being, you build an app using the mingw/gcc >>> suite and a customer uses it in a cygwin shell and has things >>> like vi >>> complain about files being read-only. Just a general, crappy user >>> experience.) > > What would you have the MinGW developers do about this? Rewrite > the C runtime library that MinGW uses, to make it Cygwin-aware? > > Wouldn't you have the same issue if you built the app with msvc? Thanks for the response. Well, there's the rub. Using Visual Studio (2005) I made a slightly different program: // temp.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "Wtypes.h" #include "winuser.h" #include "winbase.h" int _tmain(int argc, _TCHAR* argv[]) { HANDLE handle; /* handle = CreateFile(_T("foo"), GENERIC_READ|GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); CloseHandle(handle); */ FILE *fp; fp = fopen("foo", "w"); if (fp == NULL) { fprintf(stderr, "fopen failed\n"); exit(1); } fclose(fp); return 0; } Running the compiled result of this under cygwin yields: georgn@up /cygdrive/c/Users/georgn/Documents/Visual Studio 2005/ Projects/debug $ ls -l total 776 -rwx------+ 1 georgn None 0 Aug 27 10:52 foo -rwx------+ 1 Administrators None 40960 Aug 27 10:52 temp.exe -rwx------+ 1 Administrators None 319952 Aug 27 10:52 temp.ilk -rwx------+ 1 Administrators None 429056 Aug 27 10:52 temp.pdb And the result is the same whether I use the CreateFile or fopen interfaces. Is the C runtime that various folks refer to subject to change from system to system? Is there more than one? Is it a .dll or some static wad that gets linked into the .exe? (Sorry, I'm a long time unix hack and this windows stuff is making me mental). I'm thinking that my next experiment will be to add a sleep, pause, whatever and using something like process exploder to learn more. -g |