#453: Formaline deletes files if lib and src are symlinks ----------------------------+----------------------------------------------- Reporter: barry.wardell | Owner: Type: defect | Status: new Priority: major | Milestone: Component: Cactus | Version: Resolution: | Keywords: ----------------------------+-----------------------------------------------
Comment (by hinder):
It looks like the "link" command is first resolving the symlink to the original directory, and it appears from the description here
http://pubs.opengroup.org/onlinepubs/009695399/functions/link.html
that this is the POSIX behaviour (this is not said explicitly, but it is implied in the discussion of resolving symlinks). On Mac OS, where hard links to directories are allowed, this leads to a directory hard link dir4 which should have the same inode as dir3. Hence when you do a recursive delete on dir4, the contents of dir3 are deleted as well. This is probably one of the reasons that hard links to directories are not generally supported in Unix, and as far as I can tell, cannot be created using the "ln" command, only by the underlying "link" system call. On Linux, where hard links to directories are not allowed, it looks like the Perl "link" command is either not resolving the symlink, and hence creating a hard link to the symlink, or it is creating a new symlink to the dir2 resolved symlink. You could check the inode of the symlink to find out which.