25 Mar 2006 (Sat)

15:48:50 # Life Having too many layers of symbolic links. Linux kernel has a limitation on how many times it will resolve the symbolic links. Apparently, you won't be able to 'open' a file which has more than 5 indirections, if you let the kernel resolve the symbolic link. This is a well-meaning limitation to avoid DoS. Unrealistic workaround that come up to my mind such as to hack glibc to stat the symbolic links before opening, or making applications to call canonicalize_file_name before open. Sometimes, this gets annoying.

$ ls -l 
total 4
-rw-r--r-- 1 dancer dancer 5 Mar 25 15:49 a
lrwxrwxrwx 1 dancer dancer 1 Mar 25 15:49 b -> a
lrwxrwxrwx 1 dancer dancer 1 Mar 25 15:49 c -> b
lrwxrwxrwx 1 dancer dancer 1 Mar 25 15:49 d -> c
lrwxrwxrwx 1 dancer dancer 1 Mar 25 15:49 e -> d
lrwxrwxrwx 1 dancer dancer 1 Mar 25 15:49 f -> e
lrwxrwxrwx 1 dancer dancer 1 Mar 25 15:49 g -> f
lrwxrwxrwx 1 dancer dancer 1 Mar 25 15:49 h -> g
$ cat b
test
$ cat h
cat: h: Too many levels of symbolic links
$ realcsh.c 
REAL csh: #include <stdlib.h>
REAL csh: #define _GNU_SOURCE
REAL csh: printf("%s\n", canonicalize_file_name("h"));
/tmp/t/a
	
Junichi Uekawa

$Id: dancer-diary.el,v 1.90 2006/01/31 11:16:16 dancer Exp $