coreutils
[Top][All Lists]
Advanced

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

Re: rm --do-what-i-mean


From: Pádraig Brady
Subject: Re: rm --do-what-i-mean
Date: Sat, 6 May 2023 17:35:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Thunderbird/109.0

On 06/05/2023 15:48, Philip Rowlands wrote:
As mentioned in the coreutils gotchas, rm cannot always delete directory 
hierarchies.

I'm sure the folks on this list could write

$ find -type d -exec chmod +wx {} +

in their sleep but it's not the most obvious way out of unwritable directories.

Feels like a long shot, but could we add a new option to rm to add wx bits to 
each directory encountered during a --recursive walk?

Perhaps -ff for "double force"? :) I looked for prior art in the *BSDs, but 
found nothing.

Yes maybe. It is quite a common requirement.
For example I see the coreutils test suite does:

  chmod -R u+rwx "$test_dir_"
  rm -rf "$test_dir_"

On the other hand there are other permissions like,
immutable bits, ACLs, ... that may restrict removal,
so a chmod u+wx may be ineffective.

As for -f implicitly bypassing this protection,
that seems too risky at this stage, as systems
could be dependent on this protection on dirs.
I.e. if we were to support this functionality
it would have to be under a new option as you suggest
(which does detract a bit from adding it).

cheers,
Pádraig



reply via email to

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