delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/05/01/19:01:43

X-Spam-Check-By: sourceware.org
Date: Mon, 1 May 2006 19:01:30 -0400 (EDT)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
Subject: Re: "rm -rf ./foo/" safe to use?
In-Reply-To: <20060501220522.GB1574@trixie.casa.cgf.cx>
Message-ID: <Pine.GSO.4.63.0605011858510.28555@access1.cims.nyu.edu>
References: <200604261436 DOT k3QEa3AB022090 AT tigris DOT pounder DOT sol DOT net> <Pine DOT GSO DOT 4 DOT 63 DOT 0605011722450 DOT 28555 AT access1 DOT cims DOT nyu DOT edu> <20060501220522 DOT GB1574 AT trixie DOT casa DOT cgf DOT cx>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

On Mon, 1 May 2006, Christopher Faylor wrote:

> On Mon, May 01, 2006 at 05:27:16PM -0400, Igor Peshansky wrote:
> >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.
>
> I understand why you weren't inclined to test this but, really, I don't
> think it's helpful to spread this kind of FUD based on possibly faulty
> human recollection.  If you weren't capable of testing it, then at least
> a URL which showed the past problem seems called for.
>
> Anyway, I just tested this and my cygwin directory is intact.  strace
> shows that "rm" didn't attempt anything remotely like attempting to
> remove my cygwin root directory.  It's hard to think of a scenario which
> would cause rm to misbehave since a nonexistent mount point would still
> translate to a nonexistent windows path and any attempt to unlink or
> rmdir that path would fail pretty quickly.
>
> But, now this is part of cygwin lore and I'm sure someone will quote
> this email in 2009.
>
> "I have missing files!!!!  Could this be the problem???"

I'm sorry to admit that I've never reported this problem (since I,
understandably, only had it once, about a year ago).  I will get my hands
on a clean machine and try to reproduce the conditions (if my memory
serves me right).  It's also likely, as I stated, that the problem has
already been fixed -- I'll report to the list if I can't reproduce it
either.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT 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/

- Raw text -


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