Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Sun, 5 Oct 2003 19:43:53 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com Subject: Re: cygpath hangs from postinstall scripts when called like $(cygpath -S) but not otherwise In-Reply-To: <20031004174455.GD31073@redhat.com> Message-ID: References: <1065241514 DOT 18546 DOT 19 DOT camel AT localhost> <00dd01c38a7b$fbfc91f0$12760251 AT ximenes> <20031004174455 DOT GD31073 AT redhat DOT com> Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Sat, 4 Oct 2003, Christopher Faylor wrote: > On Sat, Oct 04, 2003 at 10:52:26AM -0400, Igor Pechtchanski wrote: > >On Sat, 4 Oct 2003, Cliff Hones wrote: > > > >> I ran cygcheck on cygpath, and was surprised to discover > >> that it has a dependence on msvcrt (as well as cygwin1): > >> > >> $ cygcheck /bin/cygpath.exe > >> D:/cygwin/bin/cygpath.exe > >> D:/cygwin/bin\cygwin1.dll > >> D:\WINNT\system32\KERNEL32.dll > >> D:\WINNT\system32\NTDLL.DLL > >> D:\WINNT\system32\SHELL32.DLL > >> D:\WINNT\system32\GDI32.DLL > >> D:\WINNT\system32\USER32.DLL > >> D:\WINNT\system32\ADVAPI32.DLL > >> D:\WINNT\system32\RPCRT4.DLL > >> D:\WINNT\system32\SHLWAPI.DLL > >> D:\WINNT\system32\msvcrt.dll > >> D:\WINNT\system32\COMCTL32.DLL > >> > >>I thought that using the msvcrt and cygwin1 dll's in the same > >>executable was likely to cause crashes or hangs - is this no longer the > >>case, or could this be the problem with the postinstall? > > > >Wow! Good thinking, Cliff! I think you may be on to something... ISTM > >that the problem could manifest itself when running from setup as > >opposed to from the shell because setup is a Windows program, so some > >MSVCRT functions may be found before the Cygwin ones... We could test > >by using "cygstart cygpath" or "run cygpath" or something. > > I don't know what the statement "some MSVCRT functions may be found > before the Cygwin ones" means. > > Who's going to find these functions? cygpath.exe is not going to > accidentally use ar function with the same name from another DLL. That's > not how it works. msvcrt is being loaded by SHLWAPI.DLL so there isn't > much likelihood of toe stepping between it and cygwin. I would suspect > that cygpath isn't the only program which loads msvcrt in this fashion. > There's not much we can do about it, and if it was a problem, I think > we'd know about it by now. Well, I doubt it, as it is reiterated over and over on this list and in the FAQ that mixing cygwin1.dll with msvcrt.dll is a bad idea. The only application I could find on my system with such a property is /usr/X11R6/bin/XWin.exe (through DDRAW.dll). I may have described the actual mechanism overly simplistically (and frankly, I'm not too sure on exactly how it works), but it seemed likely to be the reason for the hang. And before you ask, I'm unable to reproduce the actual hang, so I can't debug it. > Adding cygstart just adds another non-cygwin process in the mix, causing > cygwin's exec stub to behave differently. So does adding "setup". It would be easy to check if the above was the reason for the hang by trying to call the following program from a postinstall script and seeing if it also hangs: ------------------------ BEGIN tdll.c ------------------------- #include static int counter = 0; int hello() { fprintf (stderr, ""); /* to pull in msvcrt.dll */ return counter++; } ------ Note: cutting here may damage your screen surface ------ ------------------------ BEGIN tapp.c ------------------------- int hello(); int main() { printf("%d\n", hello()); printf("%d\n", hello()); } ------ Note: cutting here may damage your screen surface ------ $ gcc -mno-cygwin -shared -g -o tdll.dll tdll.c $ gcc -g -o tapp.exe tapp.c -L./ -ltdll $ cygcheck tapp.exe Found: .\tapp.exe tapp.exe C:\cygwin\bin\cygwin1.dll C:\WINNT\System32\KERNEL32.dll C:\WINNT\System32\NTDLL.DLL .\tdll.dll C:\WINNT\System32\msvcrt.dll $ ./tapp.exe 0 1 $ This would probably be easier to debug than cygpath, too... Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "I have since come to realize that being between your mentor and his route to the bathroom is a major career booster." -- Patrick Naughton -- 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/