[net.bugs.4bsd] rm and symbolic links

archiel@hercules.UUCP (06/06/84)

I just found out the hard way that if one runs "rm -r" on a directory that
contains a symbolic link, the object that the link points to gets removed
(recursively).  Since plain old "rm" run on a symbolic link removes the
link but NOT the object that it points to, I was surprised by this behavior
(no flames, please).

This behavior is, in my opinion, not obvious until after you've experienced it.
I am submitting this so that no one who reads it will be similarly surprised.
Be careful of this one.  It can really hurt!
-- 

				Archie Lachner
				Logic Design Systems Division
				Tektronix, Inc.

uucp:    {ucbvax,decvax,pur-ee,cbosg,ihnss}!tektronix!teklds!archiel
CSnet:   archiel@tek
ARPAnet: archiel.tek@csnet-relay

jonab@sdcrdcf.UUCP (06/06/84)

In article <214@hercules.UUCP> archiel@hercules.UUCP (Archie Lachner) writes:
>I just found out the hard way that if one runs "rm -r" on a directory that
>contains a symbolic link, the object that the link points to gets removed
>(recursively).  Since plain old "rm" run on a symbolic link removes the
>link but NOT the object that it points to, I was surprised by this behavior
>(no flames, please).
>
>This behavior is, in my opinion, not obvious until after you've experienced it.
>I am submitting this so that no one who reads it will be similarly surprised.
>Be careful of this one.  It can really hurt!

In my opinion, this is a bug, not a feature.  A symbolic link should be
treated as much like a hard link by the system as is possible.  Thus
the object pointed to by the symbolic link should be recusively removed only
if the object is a directory, not if it is a normal file.  This is what
would happen if the link was a hard link, not a symbolic one.

Jon Biggar
{allegra,burdvax,cbosgd,hplabs,ihnp4,sdccsu3}!sdcrdcf!jonab