On 02/01/2011 07:02 AM, Rafael Torres wrote: > Hi all, > > I've accidentally created a symbolic link that points to itself : > > [rtorres@rtorres tmp]$ ln -s tst tst > [rtorres@rtorres tmp]$ ls -la tst > lrwxrwxrwx 1 rtorres rtorres 3 Feb 1 11:59 tst -> tst
Yep, and it's not a bug in ln. > Is it a small bug in symlink() or is there any purpose for such "feature" ? Feature. POSIX requires it. Trying to resolve such a symlink will result in ELOOP; but no one said you have to resolve a dangling or looping symlink. It is also possible to create symlinks solely for the purpose of readlink()ing their contents (symlinks serve as a great file-system based atomic lock point; and at least emacs uses them for this purpose, where only the contents of the symlink are worth anything, the locks that emacs creates are not intended to be resolved as files). -- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
