Subject: Re: rm patch
To: None <>
From: Bernd Ernesti <>
List: tech-userlevel
Date: 08/22/2006 08:33:55

On Mon, Aug 21, 2006 at 10:47:54PM +0100, Liam J. Foy wrote:
> Since this is rm, anyone any objections to the following patch:
> Idea from FreeBSD, fix is slighty diff however...

It would be nicer if you would mention the problem in this mail and
attached the patch to your mail.

To quote the patch:

: Only unlink the file if indeed it has been overwritten. For example,
: $echo "hello" > moo; chmod 444 moo
: $rm -P moo
: override r--r--r--  liamfoy/users for 'moo'? y
: rm: moo: Permission denied
: $
: File moo will have been removed without have being written over.
: Also, when we goto err remember to close fd.

That was the example before your patch, how would the example
look like after someone applied it?

I'm currious about the behaviour if you said yes to overwrite it
and then 'rm' would try to remove it after that. Would it ask again
to remove it because of the missing write permission and what
would happen if you denie that then?
Or would the -P unconditionally overwrite the file without
asking for the permission and then the override message comes
from the remove stage?