Re: [OT] Hardlinks and directories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 12 February 2010 06:06 AM, Marko Vojinovic wrote:
> On Friday 12 February 2010 07:23:02 Suvayu Ali wrote:
>> $ ln muse test
>> ln: `muse': hard link not allowed for directory
>>
>> So I did a little searching and found its not exactly a forbidden. So
>> far the closest to an understandable explanation/reasoning I came across
>> was a discussion in lwn[1]. So my question is how are hardlinks so
>> different from softlinks?
>
> If you are familiar with the concept of memory pointers in some (any)
> programming language, this is basically the same thing.
>
> A hard link is a pointer to some data on the disk.
>
> A soft link is a pointer to a pointer.

This is a wonderful example! This made it much easier for me to 
understand. :)

> Now, hard links are not allowed for directories since they would allow for
> creation of loops (a directory containing itself), which is a Bad Idea, since
> it breaks recursion. The filesystem needs to be a *tree* if recursion is to
> function, so loops are forbidden (how would you delete a directory which
> contains itself?).

I don't quite follow you here, don't you mean hardlinking directories 
have the risk of introducing recursion?

> However, soft links to directories are allowed, since they are just pointers
> to other pointers, which makes them distinguishable from regular pointers
> (hard links), and thus recursion algorithms can work around them ("don't
> follow a symbolic link when recursing" is a typical option you can find in a
> man page of various tools).

Yup! got it. :)

>
> HTH, :-)
> Marko
>

Thanks
-- 
Suvayu

Open source is the future. It sets us free.
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux