delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/01/22/23:08:29

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Wed, 22 Jan 2003 23:08:11 -0500 (EST)
From: Glenn Fowler <gsf AT research DOT att DOT com>
Message-Id: <200301230408.XAA82630@raptor.research.att.com>
Organization: AT&T Labs Research
Mime-Version: 1.0
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 <gsf AT research DOT att DOT com> 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/

- Raw text -


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