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: Bob Proulx
Subject: Re: "rm -rf" [4.0p] doesn't
Date: Mon, 12 Mar 2001 22:32:54 -0700

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]