List Info

Thread: why forbids making hard link for directory?




why forbids making hard link for directory?
user name
2007-01-30 00:18:26
I know it forbids making hardlink for directory in current
filesystem,
but i don't know why? Can you tell me why?

-- 
Shaochun Wang <scwangios.ac.cn>

GPG Fingerprint: 70C2 6945 0E46 E08B 419A  007C AC5C F21F
358A 0833
You can get my publickey from the following url:
	http://lcs.ios.ac.cn/~scwang/docs/scwangpublickey.gpg
-- 
gentoo-usergentoo.org mailing list


Re: why forbids making hard link for directory?
user name
2007-01-30 00:25:42
On Tue, 30 Jan 2007 14:18:26 +0800
Shaochun Wang <scwangios.ac.cn> wrote:

> 
> I know it forbids making hardlink for directory in
current filesystem,
> but i don't know why? Can you tell me why?
> 
from `man ln`

       On  existing  implementations,  if it is at all
possible to make
a hard link to a directory, this may be done by the
superuser only.
POSIX for- bids  the  system call link(2) and the utility ln
to make
hard links to directories (but does not forbid hard links to
cross
filesystem  bound- aries).
-- 
gentoo-usergentoo.org mailing list


Re: why forbids making hard link for directory?
user name
2007-01-30 03:50:31
On Tue, Jan 30, 2007 at 02:18:26PM +0800, Shaochun Wang
wrote:
> 
> I know it forbids making hardlink for directory in
current filesystem,
> but i don't know why? Can you tell me why?

You could make a cycle (like directory placed inside itself)
that would
be undetectable and all the nice utils like find, grep -r,
cp and so
would work forever traversing them.

-- 
There's the light at the end of the the Windows.

   -- Havlik Denis

Michal 'vorner' Vaner
Re: why forbids making hard link for directory?
user name
2007-01-30 04:27:11
On 30/01/07, Shaochun Wang <scwangios.ac.cn> wrote:
> I know it forbids making hardlink for directory in
current filesystem,
> but i don't know why? Can you tell me why?

Hardlinking directories is forbidden as it allows you to
introduce
loops into the filesystem. E.g. directory "a"
within "b" within "a"
again. See this thread on LKML, kicked off by a patch to
allow
hardlinked directories, for more information on why this is
a very bad
idea:

http://www.gossamer-threads.com/lists/linux/kernel/6690
80

Cheers,
Duane.

-- 
"I never could learn to drink that blood and call it
wine" - Bob Dylan
-- 
gentoo-usergentoo.org mailing list


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )