This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Bug in rm -r with locked files
- From: Glenn Fowler <gsf at research dot att dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 22 Jan 2003 23:08:11 -0500 (EST)
- Subject: Re: Bug in rm -r with locked files
- Organization: AT&T Labs Research
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@research.att.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/