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 Date: Wed, 22 Jan 2003 23:08:11 -0500 (EST) From: Glenn Fowler Message-Id: <200301230408.XAA82630@raptor.research.att.com> Organization: AT&T Labs Research Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: cygwin AT cygwin DOT com Subject: Re: Bug in rm -r with locked files the problem reproduces on 1.3.12(0.54/3/2) I believe its a bug in rm itself the ast rm (http::/www.research.att.com/sw/download/) works fine these commands illustrate the problem window#1: mkdir /tmp/directory window#1: vi /tmp/directory/file window#2: /bin/ls -alR /tmp/directory /tmp/directory: total 4 drwxr-xr-x 2 gsf None 0 Jan 22 04:40 . drwx------ 13 Administ None 0 Jan 22 04:39 .. -rw------- 1 gsf None 4096 Jan 22 04:40 .file.swp window#2: # note that /tmp/directory/file does not exist window#2: # note that vi created .file.swp window#2: /home/gsf/arch/cygwin.i386/bin/rm -r /tmp/directory rm: /tmp/directory/.file.swp: not found rm: /tmp/directory: directory not removed [Directory not empty] window#2: /home/gsf/arch/cygwin.i386/bin/rm -rf /tmp/directory window#2: echo "exit code $?" exit code 1 window#2: /bin/ls -alR /tmp/directory /bin/ls: /tmp/directory/.file.swp: No such file or directory /tmp/directory: total 0 drwxr-xr-x 2 gsf None 0 Jan 22 04:40 . drwx------ 13 Administ None 0 Jan 22 04:39 .. window#2: /bin/rm -r /tmp/directory /bin/rm: cannot remove `/tmp/directory/.file.swp': No such file or directory /bin/rm: cannot remove directory `/tmp/directory': Directory not empty window#2: /bin/rm -rf /tmp/directory ^C to break hang the last ls exposes the rm bug readdir() returns .file.swp but a subsequent stat() on .file.swp fails with ENOENT gnu rm -rf probably assumes that ENOENT means the file was already removed and that screws up its logic when a subsequent rmdir() returns ENOTEMPTY ast rm has loop detection on rmdir() to avoid problems like this such problems are not limited to unix on windows -- Glenn Fowler AT&T Labs Research, Florham Park NJ -- -- 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/