Subject: bug#34700: rm refuses to remove files owned by the user, even in force mode

From: Eric Blake <[email-masked]>
Date: Fri, 1 Mar 2019 07:58:38 -0600

On 3/1/19 6:48 AM, Nicolas Mailhot wrote:
> Hi,
> 
> For their own reasons, the Go maintainers have decided the user Go cache
> will now be read-only.
> https://github.com/golang/go/issues/27161#issuecomment-433098406
> 
> That means cleaning up cache artefacts with rm does not work anymore
> https://github.com/golang/go/issues/30502
> 
> I understand the need to protect read only files (even though they're
> supposed to have been created by a user decision, not by user-hostile
> tools). However should not rm remove the files anyway in force (-f) mode
> without an explicit chmod first? Do it without bothering me is why -f
> exists after all.

The behavior of -f is specified by POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html

and is specified to suppress prompts and avoid diagnostics on missing
files, but NOT a means to force deletion via changing directory
permissions.  For that, you'd need a new option, because we can't change
the long-specified meaning of -f without breaking scripts.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org