[buug] ln -sf bug

Chris Waters xtifr at debian.org
Fri Aug 6 13:48:50 PDT 2004


On Fri, Aug 06, 2004 at 01:13:02PM -0700, johnd wrote:
> On Thu, Aug 05, 2004 at 07:43:40PM -0700, Chris Waters wrote:
> > That definitely looks like an unexpected result.  I note that the time
> > stamp didn't change. It appears as if the command is simply failing.
> > Why, I don't know.  Does "rm linux" work?

> rm works, then ln -s works...

> it is a local drive

Yup, ok, I've managed to reproduce the effect.  My initial test didn't
show anything, but that's because my links weren't actually pointing
anywhere.  Once Rick and Ian reported the same problem, I looked a
little closer, and here's what's happening:

 ~# mkdir d1 d2; ln -sf d1 link
 ~# ls -l link
lrwxrwxrwx  1 root root 2 Aug  6 13:43 link -> d1
 ~# ls -l d1
total 0
 ~# ln -sf d2 link
 ~# ls -l link
lrwxrwxrwx  1 root root 2 Aug  6 13:43 link -> d1
 ~# ls -l d1
total 0
lrwxrwxrwx  1 root root 2 Aug  6 13:43 d2 -> d2

Note the last result.  There's now a new link *inside* the directory
pointed to by the old link!

The behavior makes sense, in a way, but strongly violates the
principle of least suprise IMO.  I dunno, I'm curious what POSIX, LSB
and SUS have to say about this (if anything).

-- 
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 mailing list