peeyush
peeyush

Reputation: 2921

symbolic link to self


This was surprising to see

lrwxrwxrwx 1 root root    1 2011-08-23 17:18 common -> .

This says that a directory has a symbolic link to itself.
But i am not able to figure out the purpose of doing so.
I found this in firefox package .

So what is the purpose of this linking ?

Upvotes: 3

Views: 2451

Answers (1)

JJ.
JJ.

Reputation: 5475

It allows accessing files in the current directly using directory alias "common". Perhaps in the past Mozilla had a directory of "common" files which were later redirected to the same directory ".". Rather than edit code to remove all instances of "common/" they just created this symlink (just a guess).

Imagine you have 100 source code files that depend on file "common/include.xxx". For some reason you now need to move that file to "./include.xxx" instead of "./common/include.xxx". Instead of modifying 100 source code files, you can instead create this symlink and your source code will continue to compile without modification.

Upvotes: 9

Related Questions