delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/06/19/15:18:32

X-Spam-Check-By: sourceware.org
Message-ID: <4496F86C.9050707@cygwin.com>
Date: Mon, 19 Jun 2006 15:18:04 -0400
From: "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8) Gecko/20060112 Fedora/1.5-1.fc4.remi Thunderbird/1.5 Mnenhy/0.7.4.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Unable to delete directory in Cygwin
References: <1F211FE03383644EAA6BB7A52FCD9B9B0927A4 AT sohm DOT kpit DOT com> <4491562C DOT 4020702 AT byu DOT net> <e76efg$cr3$1 AT sea DOT gmane DOT org>
In-Reply-To: <e76efg$cr3$1@sea.gmane.org>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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

mwoehlke wrote:
> Eric Blake wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> According to Gina Verlekar on 6/15/2006 3:53 AM:
>>> Hi,
>>>
>>> I have implemented some changes in the linker code for some intermediate
>>> processing. For that I need to create a temporary directory, generate
>>> some intermediate  in it, process those files by calling a function.
>>> After processing of the intermediate files, I delete the intermediate
>>> files and the temporary directory.   
>>> While this logic works fine in the linux, the temporary directory does
>>> not get deleted in cygwin.
>>
>> Windows is not Linux, and will not allow users to delete in-use
>> directories (where a directory is considered in-use if it contains files,
>> or if any process is using that directory as its current working
>> directory), nor the clean deletion of files that are still open.  POSIX
>> allows this behavior, and cygwin cannot change Window's implementation of
>> deletion semantics.  Just because Linux behaves nicer doesn't mean 
>> that it
>> is portable to remove in-use directories.  Fix your code to first close
>> all outstanding file handles before trying to remove the files, and then
>> the directory.
>>
>> That said, cygwin does try to emulate linux, and if someone were to
>> contribute a patch that would allow cygwin to emulate directory deletion
>> if it knows that all open handles have also been scheduled for unlinking
>> at process end, then http://cygwin.com/acronyms/#PTC.
> 
> Not a patch, but for the record, it looks like Interix solves this 
> problem (http://www.interopsystems.com/tools/tm.aspx?m=9403). Maybe 
> Cygwin could do something similar?
> 
> (And in case that link dies; apparently Interix has a special 'temp' 
> directory where "unlinked" files are sent until their handles are all 
> closed.)
> 


If you take a look at the cygwin sources, you'll see that Cygwin does
something similar already.  This does not solve the problem for those
that want to unlink and immediately recreate the unlinked entry though...


-- 
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
838 Washington Street                   (508) 893-9889 - FAX
Holliston, MA 01746

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