Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Apr 1997 22:15:42 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        davidn@labs.usn.blaze.net.au, freebsd-bugs@hub.freebsd.org
Subject:   Re: bin/3399: mv of symbolic link can move directory instead of link
Message-ID:  <199704281215.WAA17698@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
> > If a symbolic link is entered with a trailing /, the directory it
> > references instead of the link is moved.  This could cause loss of
> > data, if someone assumes that the original directory was not affected.
> 
> Wrong assumption. :-)
> 
> IMHO this a a feature, not a bug. Many programs assume you wish to
> look "through" a symlink if you add the trailing slash. /bin/ls, for
> example. mv's behaviour therefore would seem to be expected.

It is a feature (the trailing slash says to follow the link), but many
systems do it differently.  FreeBSD itself does rmdir differently -
rmdir("symlink/") fails although rename("symlink/", "newname") renames
the direcory pointed to by "symlink" to "newname".  Note that you have
to use rename(2) instead of mv(1) to test this.  mv may rewrite some of
the names.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704281215.WAA17698>