Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does creating a symbolic link to another symbolic link have any side-effects?

Tags:

linux

symlink

Does creating a symlink to another symlink on a linux box have any side effects (specifically in terms of performance)?

like image 991
5gfbtest Avatar asked Jan 14 '11 19:01

5gfbtest


People also ask

Are symbolic links Safe?

While symlinks are very useful for day to days work, they are prone to spread harvoc when used by malicious users or programs. There are many well-documented cases, where programs running with elevated privileges consume symlinks, that were placed there by other users.

Do symbolic links work both ways?

Yes, a symbolic link is a pointer to another location. This means that any changes you make are in fact updating at the target location.

Does symbolic link increase link count?

As illustrated, when we create a symbolic link, we create an inode that contains the file name of the file that we want to link to. When we create a hard link, we set the inode number to be the inode of the file that we want to link to. This will increase the link count of that file by one.

Can symbolic links be copied?

We can use the -l option of rsync for copying symlinks. rsync copies the symlinks in the source directory as symlinks to the destination directory using this option. Copying the symlinks is successful in this case.


1 Answers

In general, no. Technically, there will be a very slight performance hit for the indirection, but it won't be noticeable to your application. As an example, most shared libraries are symlinks to symlinks (e.g. libQtCore.so -> libQtCore.so.4 -> libQtCore.so.4.7 -> libQtCore.so.4.7.1).

like image 99
Daniel Gallagher Avatar answered Sep 24 '22 21:09

Daniel Gallagher