X-Spam-Check-By: sourceware.org
Date: Mon, 1 May 2006 17:27:16 -0400 (EDT)
From: Igor Peshansky <pechtcha@cs.nyu.edu>
Reply-To: cygwin@cygwin.com
To: cygwin@cygwin.com
Subject: Re: "rm -rf ./foo/" safe to use?
In-Reply-To: <200604261436.k3QEa3AB022090@tigris.pounder.sol.net>
Message-ID: <Pine.GSO.4.63.0605011722450.28555@access1.cims.nyu.edu>
References: <200604261436.k3QEa3AB022090@tigris.pounder.sol.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Wed, 26 Apr 2006, Tom Rodman wrote:

> Rightly or wrongly over the years I've refrained from using
> cygwin to delete large directories; instead, from bash I'll cd
> to the parent dir, and run:
>
>   cmd /c rmdir /s /q MYDIR2DELETE
>
> I think I had read something years back about cygwin's inode
> simulation (sorry to munge up the terminology), being imperfect;
> so that may have convinced me to not use "rm -rf DIRXXX".
>
> So is "rm -rf ./foo/" safe to use?  Is there any danger that
> anything other than ./foo/ will be deleted?
>
> Thanks for any help, I'm mainly just curious.  :->

IIRC, there was one situation in which "rm -rf" ended up removing
something other than the specified directory: if there were a mount that
was stale (i.e., pointed to something no longer present), and you tried to
remove the mount point directory, rm would happily start removing the
root.  However, I haven't tried this after the change that made mount
points appear in readdir(), so this may no longer be the case.  For those
brave enough to try it:

cd /
mkdir BLAH
mount c:\NonExistentDir /BLAH
rm -rf /BLAH

I'd be really interested in knowing whether this is still a problem.
Disclaimer -- this used to remove the whole c:\cygwin subtree.  You have
been warned.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

--
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/

