rm and symbolic links (4.2)
jonab at sdcrdcf.UUCP
jonab at sdcrdcf.UUCP
Wed Jun 6 23:20:33 AEST 1984
In article <214 at hercules.UUCP> archiel at 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
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list