X-Spam-Check-By: sourceware.org Message-ID: <4491562C.4020702@byu.net> Date: Thu, 15 Jun 2006 06:44:28 -0600 From: Eric Blake User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: cygwin AT cygwin DOT com, GinaV AT KPITCummins DOT com Subject: Re: Unable to delete directory in Cygwin References: <1F211FE03383644EAA6BB7A52FCD9B9B0927A4 AT sohm DOT kpit DOT com> In-Reply-To: <1F211FE03383644EAA6BB7A52FCD9B9B0927A4@sohm.kpit.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 -----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 > files 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. > > /* ldmain.c */ > main() > { > . > . > my_function(); > . > . > delete tmp_directory;//I have to delete the tmp_directory only here > } pseudocode like this is worthless when asking for help. Post a simple, self-contained, compiling testcase if you want more help. - -- Life is short - so eat dessert first! Eric Blake ebb9 AT byu DOT net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEkVYs84KuGfSFAYARAuREAJ9EnUBagCb2fXjvJ0y77GKkF+ZXCgCfdo4Y l0H2f8Bd6sxUSEQ5mglS8Tw= =YWk6 -----END PGP SIGNATURE----- -- 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/