bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ln -sf foo symlink_to_directory


From: Bruno Haible
Subject: ln -sf foo symlink_to_directory
Date: Thu, 5 Feb 2004 20:41:05 +0100
User-agent: KMail/1.5

Hi,

ln (GNU coreutils 5.1.1) on Linux 2.4.x, when given the command

     ln -sf foo symlink_to_directory

puts the symlink to 'foo' into the directory. I would have expected it to
replace the symlink_to_directory. Rationale:

  - http://www.opengroup.org/onlinepubs/007904975/utilities/ln.html
    specifies that ln should look at whether the last operand
    "does not name an existing directory".

  - 
http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap04.html#tag_04_11
    specifies that when a pathname has no trailing slash, pathname resolution
    is complete without looking up the target of a symlink, i.e. that lstat()
    should be used instead of stat().

The description (info pages) of --no-dereference say:

  "The default is to treat a destination that is a symlink to a directory
   just like a directory."

Is that consistent with POSIX?


To reproduce:

$ mkdir bar
$ ln -s bar lnk
$ ln -sf foo lnk
$ ls -l lnk foo bar 
ls: foo: No such file or directory
lrwxrwxrwx    1 haible   users           3  5. Feb 20:30 lnk -> bar

bar:
insgesamt 0
lrwxrwxrwx    1 haible   users           3  5. Feb 20:31 foo -> foo


Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]