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 X-Injected-Via-Gmane: http://gmane.org/ To: cygwin AT cygwin DOT com Path: not-for-mail From: Shankar Unni Subject: Re: Bug in rm -r with locked files Date: Tue, 21 Jan 2003 11:05:29 -0800 Lines: 39 Message-ID: <3E2D99F9.2040204@cotagesoft.com> References: <232810-220031221163510989 AT M2W098 DOT mail2web DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet AT main DOT gmane DOT org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en lhall AT pop DOT ma DOT ultranet DOT com wrote: > You may find the 'handle' utility from www.sysinternal.com a handy > (no pun intended :-) ) tool for determining which files are opened > by which processes. I don't think that was the primary issue. The issue was that if a process is using a directory as its working directory (chdir()'ed into it), "rm -rf" goes into an infinite loop attempting to remove the directory (rather than print an error and move on). Definitely a bug, and still a bug. NOTE: The "-f" flag is crucial to reproducing this - without the "-f", rm gives an error and exits. Here's how to reproduce From one bash: mkdir /cygdrive/c/temp/foo (some path) vi /cygdrive/c/temp/foo/x.txt :w From a second bash: rm -rf /cygdrive/c/temp/foo (Hangs, with rm.exe taking ~100% of the CPU) My package versions: fileutils 4.1-1 cygwin 1.3.18-1 bash 2.05b-8 vim 6.1-2 This doesn't happen, by the way, if you simply "cd" into the directory in the first bash, and do nothing else - in that situation, the "rm -rf" just emits a "Permission denied" error and exits. Does bash do something special to the directories it chdir()s to? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/