Why aren't (hard) links to symbolic links allowed?

Leo de Wit leo at ehviea.ine.philips.nl
Thu May 10 05:50:06 AEST 1990


In article <1990May9.171340.5351 at ucselx.sdsu.edu> g-patena at steer.UUCP (Mitch Patenaude) writes:
|In article <874 at nlsun1.oracle.nl> bengsig at oracle.nl (Bjorn Engsig) writes:
|[stuff deleted]
|>........................... Shouldn't I be able to have more than one (hard)
|>link to a file that happens to be a symbolic link?  If no, then why not?
|  No.. in fact.. you don't even have one hard link... a symbolic link is 
|just a specialized direcotry entry which makes reference to another 
|filename (not even the i-node.. just the filename.. if the file it 
|references  is moved or deleted.. the link does not follow it).. while a    
|hard link makes another link to the i-node (and becomes indistinguishable
|from the files it's linked to.) but the sybolic link has no i-node of it's
|own.. only the referce to another file.. which is where the link is made.

And where do you think this reference resides? Directory entries are
just (filename,inode) number pairs, nothing specialized here. The
symbolic link is characterized thus by the mode bits of the inode
(S_IFLNK from <sys/stat.h>) ; the 'reference to another file' is
contained in the disk blocks for this special file.

Bjorn's question seems a valid one; a rename() emulated by a
link()/unlink() pair fails for the above reason in the case of a
symbolic link (one is left with a hard link to the original
softlinked-to file, instead of a different name for the previous soft
link).

    Leo.



More information about the Comp.unix.wizards mailing list