coreutils
[Top][All Lists]
Advanced

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

Re: [wishlist] rm -rf to alter directories permissions if necessary


From: Yaroslav Halchenko
Subject: Re: [wishlist] rm -rf to alter directories permissions if necessary
Date: Mon, 2 Feb 2015 16:47:08 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, 31 Jan 2015, Bob Proulx wrote:
> I would probably stop there without thinking further.  All of your
> .git files will be the same.  But in the general case with some one
> way and only a few the other with a little more typing can probably
> tune up the speed a little by only looking at dirs that need it.

>   find $dir -type d ! -perm -u+w -exec chmod u+w {} +

Hi Bob,

Thank you for sharing your views and providing such a detailed answer.
I guess will indeed just then stay with a bash alias/function to remove
annexes, smth like

# rm annex repository, requires first chmod'ing for +w of the objects 
directories.
rm-annex ()
{
  for d in "$@"; do
    /usr/bin/find "$d/.git/annex/objects" -mindepth 2 -maxdepth 3 -type d ! 
-perm -u+w -exec chmod u+w {} +
    rm -rf --one-file-system "$d"
  done
}

if your expert eye sees errors or ways to improve -- would be appreciated ;)

> > > If you are trying to make something
> > > more convenient and don't want the tree to be read-only then not
> > > changing the permissions to be read-only is the right place to do it.
> > not a choice for me here ;)
> Note that you haven't actually said why not yet.

just because I needed what intended to be read-only to be removed with a
conscious acknowledgement of that act by me ;)

> > > Long standing use has been that removing write capability from
> > > directories prevents files from being removed from the directory.
> > > Even when using rm -rf.  Changing that would create the exact opposite
> > > and valid bug report that 'rm -rf' removed files from write protected
> > > directories.  Worse that would be a data loss event.  rm is not
> > > allowed to chmod directories first.

> > yeah -- I hear you, rm -rf behavior shouldn't change for sure,  but e.g.
> > rm -rF could really force things ;)

> I am of the opinion that adds code bloat that it shouldn't add.  It
> doesn't really do anything that isn't already handled in other ways.
> That old thread that Pádraig linked to refreshed my memory about why I
> didn't like it.  :-)

ok - understood. Thanks again for getting back to me.

-- 
Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist,            Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        



reply via email to

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