bengsig@oracle.nl (Bjorn Engsig) (05/08/90)
If I have a file /a/a.c and do ln -s /a/a.c /b/b1.c, then ln /b/b1.c /b/b2.c (and also /etc/link) creates /b/b2.c as a hard link to /a/a.c and not as I would expect to /b/b1.c. 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? -- Bjorn Engsig, Domain: bengsig@oracle.nl, bengsig@oracle.com Path: uunet!mcsun!orcenl!bengsig
g-patena@steer.uucp (Mitch Patenaude) (05/10/90)
In article <874@nlsun1.oracle.nl> bengsig@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. >-- >Bjorn Engsig, Domain: bengsig@oracle.nl, bengsig@oracle.com > Path: uunet!mcsun!orcenl!bengsig -- Mitch Patenaude g-patena@steer.calstate.edu
leo@ehviea.ine.philips.nl (Leo de Wit) (05/10/90)
In article <1990May9.171340.5351@ucselx.sdsu.edu> g-patena@steer.UUCP (Mitch Patenaude) writes: |In article <874@nlsun1.oracle.nl> bengsig@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.
davecb@yunexus.UUCP (David Collier-Brown) (05/10/90)
leo@ehviea.ine.philips.nl (Leo de Wit) writes: | 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). Soft and hard links don't exactly mix well: the semantics are too different. I vaguely recollect one of the triple [Kernighan|Ritchie|Thompson] commenting that BSD should have removed the hard links if they were planning on adding soft ones. Specifically, the definition of a symlink as "something that when referenced is evaluated to produce a pathname" leads one to interpret the creating of a link to a symlink as creation of a link to the referred-to thing... Yet a symlink has a separate existance, can be seen in an ls, etc. which leads the unwary to trip over the (operational) definition and go crashing into "this make no sense" land. If it had a better definition, maybe I could reason about it better... --dave -- David Collier-Brown, | davecb@Nexus.YorkU.CA, ...!yunexus!davecb or 72 Abitibi Ave., | {toronto area...}lethe!dave Willowdale, Ontario, | "And the next 8 man-months came up like CANADA. 416-223-8968 | thunder across the bay" --david kipling