delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/05/20:14:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Sun, 5 Oct 2003 20:14:39 -0400
From: Christopher Faylor <cgf-rcm 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
Message-ID: <20031006001439.GB13466@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <JLEBIHHBMBHBAFPAJLEFKEMKEHAA DOT miles0201 AT cox DOT net> <1065241514 DOT 18546 DOT 19 DOT camel AT localhost> <00dd01c38a7b$fbfc91f0$12760251 AT ximenes> <Pine DOT GSO DOT 4 DOT 56 DOT 0310041050330 DOT 15176 AT slinky DOT cs DOT nyu DOT edu> <20031004174455 DOT GD31073 AT redhat DOT com> <Pine DOT GSO DOT 4 DOT 56 DOT 0310051911340 DOT 15176 AT slinky DOT cs DOT nyu DOT edu>
Mime-Version: 1.0
In-Reply-To: <Pine.GSO.4.56.0310051911340.15176@slinky.cs.nyu.edu>
User-Agent: Mutt/1.4.1i

On Sun, Oct 05, 2003 at 07:43:53PM -0400, Igor Pechtchanski wrote:
>On Sat, 4 Oct 2003, Christopher Faylor wrote:
>>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.

For *user* programs.  Say what you will about Microsoft, but presumably
they know what they are doing with their DLLs.

Usually when I mention this, I say something like "If you really know
what you're doing you can do this".  I would assume that Microsoft knows
what they are doing.

(And, please, no Microsoft jokes here.)

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

Windows DLLs have been including MSVCRT for years and, in fact,
cygpath.exe includes msvcrt.dll on my system and it doesn't hang.  On my
system, these programs include msvcrt.dll due to it's inclusion in some
system dll:

cygpath, exim, gdb, lpr, mkshortcut, passwd, 

I think that it is very unlikely that this is the problem.

>> Adding cygstart just adds another non-cygwin process in the mix, causing
>> cygwin's exec stub to behave differently.
>
>So does adding "setup".

I don't know what this means.  It is a given that running this from
setup causes a problem, since that is what the bug report is all about.
Adding another program (apparently cygstart *is* a cygwin program) to
the mix doesn't really provide any useful information, AFAICT.

>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 <stdio.h>
>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...

Why?  The above presupposes that the windows DLLs are doing I/O to FILE
pointers which AFAICT is not a given.

cgf

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

- Raw text -


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