bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "rm -rf" [4.0p] doesn't


From: Don Buchholz
Subject: Re: "rm -rf" [4.0p] doesn't
Date: Mon, 12 Mar 2001 23:11:52 -0800
User-agent: Mozilla/5.0 (X11; U; Linux 2.2.16-3 i686; en-US; m18) Gecko/20001107 Netscape6/6.0

Bob,

Thanks for the answer.  I'd check the Suns if I could, but
that was 1 job (and about 12 months) ago.  And, when performing
wholesale deletions, the odds are fairly good that I was
running as root (now that is a scary thought :-) ).  It's subtle,
but the 555 directories fouling things up seems reasonable.

Sorry about the false alarm.

Thanks again,

- Don Buchholz



Bob Proulx wrote:

Don


My understanding of "-f" might be incorrect ... I thought "-f"
would force rm(1) into removing a file, even if it was mode 444.

However, the version shipped w/ RedHat 6.2 (fileutils v4.0p)
doesn't work as expected.  For example, if I extracted the
attached (gzip'd) tar file, I would expect:

        # tar xvfz breaks_rm-rf.tar.gz
        # /bin/rm -rf sis900


Thanks for the report.  But that is not a bug.  The directories which
contain the files are not writable and therefore the rm command will
not remove the files.  The -f option will remove files mode 444 but
the directory which contains those files must be writable.  Later when
rm tries to remove the non-writable parent directory it finds it
non-empty.

Try these next commands on your example.  I used a find command
instead of chmod -R so that only the directories would be changed
writable to show that rm -f does remove files mode 444.

  find sis900 -type d -print | xargs chmod u+w
  rm -rf sis900


to simply, and quietly, remove the entire tree.  It doesn't.
(Maybe I spent too many years with SunOS and Solaris?)


Check those Sun boxes again.  I don't have access to a Sun machine
today to verify this but I believe it works the same there.  Certainly
HP-UX and IBM AIX work this way as well.

Are you sure you were not previously running the command as root?  For
root, all directories as well as files are writable.  This case can
only occur for a non-root user.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]