coreutils
[Top][All Lists]
Advanced

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

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


From: William Bader
Subject: Re: rm --do-what-i-mean
Date: Sat, 6 May 2023 16:47:48 +0000

chmod already has an X file mode that treats directories specially. Is it worth 
adding R and W modes that work similarly to X?

________________________________
From: coreutils-bounces+williambader=hotmail.com@gnu.org 
<coreutils-bounces+williambader=hotmail.com@gnu.org> on behalf of Pádraig Brady 
<P@draigBrady.com>
Sent: Saturday, May 6, 2023 12:35 PM
To: Philip Rowlands <phr+coreutils@dimebar.com>; coreutils@gnu.org 
<coreutils@gnu.org>
Subject: Re: rm --do-what-i-mean

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]