X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0	tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Message-ID: <4D7FD12F.1000200@dronecode.org.uk>
Date: Tue, 15 Mar 2011 20:50:55 +0000
From: Jon TURNEY <jon.turney@dronecode.org.uk>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Calling sem_wait() in DllMain( DLL_THREAD_DETACH) crashes
References: <4D7FB133.7030301@dronecode.org.uk> <20110315190733.GA23825@ednor.casa.cgf.cx> <4D7FC59F.6030901@cwilson.fastmail.fm> <20110315202816.GA8747@ednor.casa.cgf.cx>
In-Reply-To: <20110315202816.GA8747@ednor.casa.cgf.cx>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On 15/03/2011 20:28, Christopher Faylor wrote:
> On Tue, Mar 15, 2011 at 04:01:35PM -0400, Charles Wilson wrote:
>> On 3/15/2011 3:07 PM, Christopher Faylor wrote:
>>> On Tue, Mar 15, 2011 at 06:34:27PM +0000, Jon TURNEY wrote:
>>>>
>>>> I've come across a problem whilst trying to run the twisted test suite, where
>>>> some tests just cause python to segfault.  It seems to be the same issue with
>>>> libcrypto as reported in [2],[3]
>>
>>> Actually you aren't supposed to be able to call anything you like here
>>> and it isn't clear why a POSIX/UNIX/Linux program would be relying on
>>> DllMain.

Thanks for the clarification.

>> There are cases where cygwin-ish code does win32-ish things, like
>> login.exe, or the PyWin32 extensions for Python-on-Windows(and cygwin).
>> Maybe twisty uses PyWin32?
> 
> The python Twisted stuff works on UNIX systems so there should be no
> reason to use Windows-isms in Cygwin code - especially when the
> Windows-ism *calls* UNIX code.  The ability to get into trouble when you
> mix Windows stuff like DllMain with Cygwin stuff is very high.

Absolutely.

I did read through the UG looking for a statement like that, but the only
thing I found was the caveat about mixing POSIX and Win32 calls to set cwd.
Perhaps I overlooked something, or maybe it would be good if that was more
clearly documented.

>> However, it does seem that python (or one of its extensions) is doing
>> something it shouldn't.

Given the above clarification about cygwin, this is a bug in libcrypto from
OpenSSL (which tries to be portable to more than just POSIX, and has a
DllMain() which is built for both cygwin and Win32), and a patch like that at
[1] (or perhaps one which avoids DllMain on cygwin entirely) should be applied.

Sorry that I didn't make it more clear that the underlying issue is in
libcrypto rather than twisted or python.

[1] http://www.mail-archive.com/openssl-dev@openssl.org/msg24599.html

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

