Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How are symlinks implemented? Are references stored on both sides or only in the location where the symlink is pointing from?

Story: I have a weird "bug" in the folder view of Sublime. A folder that contains files is shown as empty, but there are files in there not starting with a dot. But there is a symlink from another location to this folder. That is the only thing I can think of right now that could be the reason why it shows as empty?

UPDATE: seems it might be related somehow to this (and therefore, related to inodes): http://www.sublimetext.com/forum/viewtopic.php?f=3&t=7142&start=10. I tried the config setting that is mentioned there in the last post, but it did not have any effect.

That is: Preferences > Settings -- User:

"ignore_inodes": true
share|improve this question
add comment

4 Answers

Symlinks can be bidirectional, if they are "hard" symlinks. However, in general symlinks are unidirectional, and the information about the link is only stored in the symlink itself. Your problem is probably not related to symlinks at all.

See here for more information: http://en.wikipedia.org/wiki/Symbolic_link

share|improve this answer
1  
A hard link is not a symlink. All symbolic links are soft links, and a hard link is something else (two file directory entries pointing to the same on-disk file). –  neon_overload Mar 30 '13 at 14:17
2  
Interesting. The question arised more as an OS curiosity than in an effort to solve the problem :) I see from manpages.ubuntu.com/manpages/lucid/man7/symlink.7.html that "hard links may not refer to directories". –  Per-Øivin Andersen Mar 30 '13 at 14:22
1  
See my answer at the bottom. Related to symlinks but a bug in Sublime Text. –  Per-Øivin Andersen Mar 30 '13 at 14:58
add comment

A symlink is implemented as a file pointer that points to a certain path.

It exists at the source only and creating a symlink causes no change to the destination. It's also possible for a symlink to be invalid - to point to a path that doesn't exist or can't be reached.

I can't see how an incoming symlink to a directory could cause any issues in that directory.

Your issue may be one of

  • Issue with Sublime (I assume you mean the text editor Sublime Text)

  • Permissions issue - can the user you're using to view see the directory entries?

share|improve this answer
    
I am running it as gksu and the folder is a part of a larger tree I have openened in Sublime. I have opened /path, and I cannot see /path/to/folder_i_wonder_about, but I can see /path/to/other/with/subfolders. –  Per-Øivin Andersen Mar 30 '13 at 14:36
add comment

"The symlink() function shall create a symbolic link called path2 that contains the string pointed to by path1 ( path2 is the name of the symbolic link created, path1 is the string contained in the symbolic link).

The string pointed to by path1 shall be treated only as a character string and shall not be validated as a pathname.

If the symlink() function fails for any reason other than [EIO], any file named by path2 shall be unaffected." Source - Symlink man page

From this a symlink is merely another name for a named path to either a file or a folder. In other words they only point one way. Have you tried creating more symlinks to confirm that it's causing the problem?

Otherwise this might be an issue with Sublime in combination with your OS. If you create other files they show up correctly? Also, what types of files are they? Have you made sure that you have added their folder to the sidebar?

Cheers, Nils

share|improve this answer
    
thank you Nils. It is probably a Sublime issue. –  Per-Øivin Andersen Mar 30 '13 at 14:26
    
Tried creating a file and save it to the folder, still not visible. See my update :) –  Per-Øivin Andersen Mar 30 '13 at 14:50
add comment

This is related to symlinks, but it is a bug in Sublime Text.

If you have opened a folder in Sublime where there is a subfolder with symlinks to another folder in the same sub structure, the original folder will show as empty. This is probably related to the GOTO command to avoid duplicates.

If you open the folder directly or open a parent folder without symlinks pointing to the apparently empty folder in the tree, the folder content will show.

See http://sublimetext.userecho.com/topic/89047-symlinked-folders-arent-displayed-properly-in-the-sidebar/, I guess the issue is not fixed

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.