X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 15 Sep 2010 12:08:28 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: 1.7.5: Occasional failure of CreatePipe or signal handing due to thread-unsafe code in cwdstuff::set Message-ID: <20100915100828.GO15121@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20100903073740 DOT GA1749 AT calimero DOT vinschen DOT de> <3C031C390CBF1E4A8CE1F74DE7ECAF3A158EDA702D AT MBX8 DOT EXCHPROD DOT USA DOT NET> <20100904092626 DOT GE16534 AT calimero DOT vinschen DOT de> <3C031C390CBF1E4A8CE1F74DE7ECAF3A158EDA704C AT MBX8 DOT EXCHPROD DOT USA DOT NET> <20100911103010 DOT GM16534 AT calimero DOT vinschen DOT de> <3C031C390CBF1E4A8CE1F74DE7ECAF3A15945FDD78 AT MBX8 DOT EXCHPROD DOT USA DOT NET> <20100914081225 DOT GE16534 AT calimero DOT vinschen DOT de> <20100914161138 DOT GG15121 AT calimero DOT vinschen DOT de> <20100914161636 DOT GH15121 AT calimero DOT vinschen DOT de> <3C031C390CBF1E4A8CE1F74DE7ECAF3A15945FDD8A AT MBX8 DOT EXCHPROD DOT USA DOT NET> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3C031C390CBF1E4A8CE1F74DE7ECAF3A15945FDD8A@MBX8.EXCHPROD.USA.NET> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Sep 14 22:09, John Carey wrote: > On Sep 14 09:11, Corinna Vinschen wrote: > > I applied the below patch to Cygwin CVS and it appears to work nicely. > > The only potential race I can think of is, if another thread of the same > > Cygwin process calls SetCurrentDirectory. I'm inclined to let this > > situation slip through the cracks since SetCurrentDirectory will already > > mess up a mixed-mode Cygwin process. > > > > The "wincap.has_transactions ()" is just for testing. If we can use > > that code, I would replace is with something like > > "wincap.has_messed_up_cwd_handling()" or so. > ... > > I would argue against introducing a race with threads that call > SetCurrentDirectory(), for at least the following reasons: > > 1. The race can be avoided without too much grief. Right. Still, the licensing issue... > 2. If a program does violate the rule against calling > SetCurrentDirectory() directly (possibly because of > some third party DLL being involved), then it could be > very difficult to detect the source of the resulting problems. But we're talking about mixed-mode Cygwin apps. They should use the Win32 API with care anyway. And the disconnection between SetCurrentDirectory and chdir already exists if the latter is called at all. > [...] > 3. The unknown. Hard to argue aginst *that*... > Anyway, one other detail: > > Are races within a pure-Cygwin program are prevented by > "cwd_lock"? I don't see it being locked yet, just initialized. > Perhaps the cwdstuff::set patch is not yet written? There's a cwd_lock.acquire and a cwd_lock.release call in cwdstuff::set. There's no such lock when cwdstuff::override_win32_cwd is called from cwdstuff::init, because at the time init is called there's no other concurrent thread running, except for the signal thread. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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