www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/12/12/11:55:31

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_YG,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Message-ID: <4D04FE72.8070309@gmx.de>
Date: Sun, 12 Dec 2010 17:55:14 +0100
From: Matthias Andree <matthias DOT andree AT gmx DOT de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: 1.7.7: rm -rf sometimes fails - race condition?
References: <4D026815 DOT 4070606 AT gmx DOT de> <20101210182652 DOT GA27615 AT ednor DOT casa DOT cgf DOT cx> <3D3D7FA2B44B477A8342F96F72AE1BE7 AT multiplay DOT co DOT uk> <20101212124248 DOT GB11357 AT calimero DOT vinschen DOT de> <4D04D92F DOT 6000002 AT gmx DOT de> <20101212151228 DOT GA8795 AT calimero DOT vinschen DOT de> <4D04E6E8 DOT 6060905 AT gmx DOT de> <20101212151956 DOT GC8795 AT calimero DOT vinschen DOT de> <20101212154656 DOT GD8795 AT calimero DOT vinschen DOT de>
In-Reply-To: <20101212154656.GD8795@calimero.vinschen.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

Am 12.12.2010 16:46, schrieb Corinna Vinschen:
> On Dec 12 16:19, Corinna Vinschen wrote:
>> On Dec 12 16:14, Matthias Andree wrote:
>> > Am 12.12.2010 16:12, schrieb Corinna Vinschen:
>> > > On Dec 12 15:16, Matthias Andree wrote:
>> > >> Am 12.12.2010 13:42, schrieb Corinna Vinschen:
>> > >> 
>> > >> > So, what cygwin tries to do in the first place is to move files in use
>> > >> > into the recycle bin.  However, on Windows you need DELETE access rights
>> > >> > to be able to do so.  And, this doesn't work for remote drives.  On
>> > >> > remote drives we can only try to rename the file to some temporary
>> > >> > filename and hope for the best.  Afterwards Cygwin sets the delete
>> > >> > dispostion flag and returns success if setting the dispostion flag
>> > >> > succeeded.  After all, that's the maximum possible on Windows, and for
>> > >> > all we can tell the file has been deleted.  The fact that the directory
>> > >> > entry lingers until the last handle to the file has been closed is
>> > >> > something Cygwin has no control over.
>> > >> 
>> > >> Well, there's the problem.
>> > > 
>> > > No, it's not, at least not on local drives.  Read again.  Files and
>> > > directories in use are moved into the bin.  If that fails, unlink/rmdir
>> > > fails.
>> > 
>> > Then I wonder what makes my cygport (or the rm command it uses) fail as it
>> > removes the workdir...
>> 
>> I guess debugging would sched a light...
> 
> Something else occured to me.  I guess I'm too much used to run the
> current snapshots, rather than the current release version of Cygwin.
> 
> Probably the file-in-use stuff is not really your problem.  There's
> another problem which is this:  If the directory you want to remove is
> the CWD of a Windows process, then removing the dir fails.  The reason
> is that the CWD handle of a Windows process is opened without the
> FILE_SHARE_DELETE sahring mode set.  So, any try to rename or remove
> that dir will fail.
> 
> For Cygwin 1.7.7, this is also true for Cygwin processes.  There was
> that handle problem with Cygwin's CWD handling on Vista and later which
> has been discussed on this list between August and October.  Since we
> had no way to fix this problem at this point, Cygwin 1.7.7 reverted to
> the old Cygwin 1.5 behaviour to use the Win32 function SetCurrentDirectory
> to set the CWD.  With obvious results.
> 
> In the meantime John Carey was so kind to dive into the OS and found a
> solution to replicate Vista's CWD handling so that Cygwin 1.7.8 will
> again be able to remove directories which are the CWD of any Cygwin
> process.  The problem with native, non-Cygwin processes holding a
> CWD handle to this directory will of course persist.

Ah, that might possibly account for races, depending on how fast we leave the
directory alone in 1.7.7.

> So, here's the question:  Did you try a recent Cygwin snapshot from
> http://cygwin.com/snapshots/?  Perhaps it fixes your problem.

Not yet, but can do. Does that entail reinstalling cyglsa since 1.7.7 (just
planning to keep the number of reboots down :-))?

-- 
Matthias Andree

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

- Raw text -


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