On Tue, 14 Jul 2026 at 02:18, Left Right <[email protected]> wrote:
>
> > If it's raising an error, then yes, at the moment, the caller does not
> > have the required permissions to delete the file. If you *do* have
> > permission to delete the file, even if it's read only, then you won't
> > get the error. I'm not sure what the conflict is here.
> > [...]
> > The error says, you don't have permission to do that. Which is a fact.
>
> Both users and administrators understand permissions as a reference to
> ownership. Owning X gives you permissions to do with X as you please,
> including deleting it.

And that's exactly how Linux treats it. I can remove a read-only file.
(The rm command checks first and requires you to pass -f in order to
do that, but the unlink() API call will let you remove a read-only
file just fine, and thus so can Python's os.unlink().) However, if the
*containing directory* is read-only, that's an indication that you
have chosen to protect it from changes. Same as protecting a file.
Yes, you own it and can lift that protection, but it's a deliberate
action you have to take.

I'm really not seeing this as a problem.

> Linux system errors are plagued with bad decisions and pathologically
> bad reporting. I would expect the same from MS Windows. There's no
> reason to ever consider them as good examples for anything besides,
> maybe, as a source for jokes.

Wow. I guess you've made your own operating system that's perfect?

> Bottom line: I think that having a FileReadOnly exception is a good
> idea because it more precisely reports the problem and gives users a
> direction for fixing it, whereas reporting permissions error doesn't.

Okay. Go ahead and make that happen, or convince someone that it needs
to be done.

ChrisA
-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to