[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn delete removes read-only files

From: Rick Varney <rick.varney_at_sbcglobal.net>
Date: Mon, 18 Nov 2013 16:37:23 +0000 (UTC)

David Chapman <dcchapman <at> acm.org> writes:

> On 11/15/2013 3:57 PM, Rick Varney wrote:
> > Branko ─îibej <brane <at> wandisco.com> writes:
> >
> >>
> >> It really depends on what you think "Unix rm" actually is. The
> >> unlink() or remove() functions don't care about permissions on the
> >> target, only that you have write permission on the parent directory.
> > It does not surprise me to hear that system functions don't care about file
> > permissions. The OS flavor I'm most familiar with is rhel5. Here is how
> > the interactive rm command behaves in this case:
> >
> > $ ll foo.txt
> > -r--r----- 1 usb00219 nxp 4 Nov 15 15:42 foo.txt
> > $ rm foo.txt
> > rm: remove write-protected regular file `foo.txt'? y
> >
> > So while rm is perfectly capable of removing the read-only file in a
> > directory where I have write permissions, it politely asks first. I had
> > assumed the rm command behaves similarly on many flavors of Unix (as well as
> > Linux).
> >
> This is probably due to an alias set up in your login script, e.g.
> .bashrc. Type "alias" at the command prompt; you will probably find
> that "rm" is aliased to "rm -i", which prompts before removing files.
> "rm" does not prompt like this by default.
> "ll" is not a Unix/Linux command either, so it's a pretty safe bet that
> you have aliases set up, either in the distro you have installed, or
> configured by your sysadmin (on my CentOS machines, this alias is
> present only for the root account by default). Try "\rm foo.txt"
> (backslash before executable name); I'll bet that it does not ask you
> for permission to remove a write-protected file.

You are right that I have an alias for ll:

alias ll='ls -l'

I looked at my aliases and grepped through my .bashrc files - no alias for
rm appears to be set. The "\rm" experiment still behaves the same way for a
read-only file:

$ \rm foo.txt
rm: remove write-protected regular file `foo.txt'? y

There is a rm -i switch. When I give it, rm then prompts before removing
files that are not write protected:

$ touch foo.txt
$ rm -i foo.txt
rm: remove regular empty file `foo.txt'? y

This is not the usual behavior I see. Finally, I found a snippet from the
rm manpage on rhel5 that speaks to this:

"If a file is unwritable, the standard input is a tty, and the -f or
--force option is not given, rm prompts the user for whether to remove the
file. If the response is not affirmative, the file is skipped."

So for Redhat 5, rm does seem to give read-only files some special
treatment. The fact that rm on your OS does not makes me wonder if I am
wrong about how typical this behavior is in other Linux/Unix flavors.

Best regards,

Received on 2013-11-18 17:38:24 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.