On Sat, 6 May 2023, at 17:35, Pádraig Brady wrote:
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).
I'd find it odd to write
rm -rf DIR
and expect the permissions to _protect_ certain files, but who knows what
existing code is out there?
Narrowly-scoped, we could have
rm -r --chmod-unwritable-directories
which does one specific thing.
On the other hand, we could have
rm -r --try-harder
towards the idea of "if these files can be deleted, then delete them". What
could this entail? chmod, chattr, setfacl, semanage, sudo??
It would be a shame for the perfect solution to be the enemy of the good, so if
--try-harder were documented initially to chmod, but reserving the right to
--try-harder in other ways as and when the need arises, would that fly?
The footrake I always step on is expanded archives which for some reason have
0555 directories, and by the time I've noticed it's too late.