Patrick Lesslie was once rumoured to have said:
> unstable provides coreutils 4.5.7-1, in which it must have been
> fixed.  Perhaps it's out of the manpage until they have finished
> implementing it ;-)

Hopefully they took the idiot who added it in the first place out the back and
shot him.  It would save the rest of us a lot of pain caused by all the idiots
who used it without realising the consequences.

It should never be implemented.  Ever.  Its fundamentally wrong.

Hardlinks work by creating another reference to the file in the directory
tables and increasing the reference count on the file so the file doesn't get
'deleted' until all references against it get removed.  This works on a simple
file to file level.

Now, lets introduce directories.  You hardlink a directory, now there are two
directory entries pointing at the directory (and the directory's reference 
count is now 2), but the files inside the directory only have a reference 
count of 1.

Now, what if a user runs rm -rf against this hardlinked directory?

rm -rf descends the directory recursively and destroys the files before 
unlinking the directory node itself.

Sure, the other directory is still there, but now its empty because the files
were unliked from it via the other path.

Furthermore, its not (normally) possible to tell what is hardlinked to what
(this information is not usually tracked in the filesystem).

Yes, there are other bad things that can happen here because you CAN NOT 
feasibly detect if a file-entry exists in a directory that has been hardlinked.
you can't kludge this so all the files in the hardlinked directory get their 
reference counts increased either - that would break things in other ways.

Just say no to hard linking directories.

Use Symlinks.  Symlinks are nice and safe.

If you must hardlink, you can use emacs hexel-mode, or other hex editor - that
way you only have yourself to blame when you break things severely.

C. 
-- 
--==============================================--
  Crossfire      | This email was brought to you
  [EMAIL PROTECTED] | on 100% Recycled Electrons
--==============================================--
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to