bug-coreutils
[Top][All Lists]
Advanced

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

Re: rm -f and unexecutable directories


From: Bob Proulx
Subject: Re: rm -f and unexecutable directories
Date: Sat, 8 Nov 2003 14:09:17 -0700
User-agent: Mutt/1.3.28i

Ed Avis wrote:
> % mkdir -p fred/jim
> % chmod a-x fred/jim
> % rm -rf fred
> rm: cannot chdir from `fred' to `jim': Permission denied

But by the action of your chmod you have specifically requested that
you do not want those files removed!  Therefore I for one will expect
that you will not be able to remove those files until you explicitly
allow it again with chmod.  Changing this behavior would break a lot
of safety that has been built into scripts over the years.

Jim Meyering wrote:
> Ed Avis wrote:
> > In that case could I make a feature request for a new flag
> >
> >     -F, --really-force
> >             As --force but also change permissions if necessary.
>
> It's feasible.
> I'm not enthusiastic about this, but not strongly opposed either.
> Let's see if anyone else has strong opinions on the matter.

Adding a new option would not break any previously existing scripts.
So I agree that it is feasible.  But I don't prefer it since its use
would not be portable systems which are standard but don't have this
extension.

<whine>
Since I work daily on GNU, HP-UX, AIX, etc. I am always running into
places where people use extensions in scripts which do not work on
other systems.  (See my 'hostname -f' problem in previous postings.
How is setting my hostname to '-f' useful? :-/)  Therefore the
addition of an option like this would only encourage people to use it!
And it would therefore generate more importable scripts which would
increase the workload of porters.
</whine>

Prompting the suggestion of:
> >     -F, --really-force
> >             As --force but also change permissions if necessary.

Please repeat after me.  Standard is better than better.  Instead of
the above why not use standard commands which will allow your script
to run on any standard system?

  mkdir -p fred/jim
  chmod a-x fred/jim

You obviously do not want the files removed.  You have chmod'd them so
that they cannot be removed.  Time passes.  You now decide to allow
them to be removed.  This works on any standard system.

  chmod -R u+Xw fred
  rm -rf fred

Bob




reply via email to

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