[buug] ln -sf bug
xtifr at debian.org
Fri Aug 6 15:22:22 PDT 2004
On Fri, Aug 06, 2004 at 02:20:29PM -0700, johnd wrote:
> the man page says -fis supposed to remove existing destination files.
> to me it seems that it doesn't
Yes, well, you had three fairly expert people at least temporarily
confused, so you certainly don't have to feel embarrassed about being
The important point is that a symlink pointing to a directory is
considered to be a directory, *not* a file. And -f doesn't remove
existing directories--it only removes files.
The confusing part is that symlinks are neither fish nor fowl; they're
an odd beast with their own peculiar rules, and it's not always
obvious when they're going to show fish-like behavior and when they're
going to show fowl-like. (Er, directory-like and file-like, for those
who find over-extended analogies annoying.) But the behavior of ln -f
is consistent with the behavior of mv -f and cp -f (which also claim
to remove existing destintation files, but won't overwrite your
"linux" link either).
The logic behind it all may become a little more obvious if you
consider that some systems are set up with /tmp as a symlink. You
still want all your scripts to act as if it were a directory. If ln,
mv and cp treated symlinks to directories differently from
directories, then a lot of stuff would break.
Or to put it another way: symlnnks generally work as you would expect
if you didn't know they were there. Unfortunately for you, in this
case, you did know there was a symlink, so that messed up your
Chris Waters | Pneumonoultra- osis is too long
xtifr at debian.org | microscopicsilico- to fit into a single
or xtifr at speakeasy.net | volcaniconi- standalone haiku
More information about the buug