value in Unix
-like operating system
s. Occurs when a pathname
passed to a system call
references a chain of symlink
s which is longer than MAXSYMLINKS
. The idea is to avoid sending namei
into an infinite loop
, which would otherwise occur whenever a symlink pointed to itself (or to a previously visited member of the chain).
Note that "loop" is therefore a slight misnomer, since a sufficiently long string of symlinks containing no loops will trigger the same error. In practice, however, MAXSYMLINKS is set to 20, which is big enough that almost all legitimate uses of symbolic links will remain legal.
IMHO, this is an excellent example of the type of engineering tradeoff that makes Unix so efficient and powerful: it would have been possible to implement this sanity check more accurately by, for example, maintaining a hash table of names visited while traversing the symbolic links1, however the chosen implementation is far less costly (in terms of cycles as well as RAM) while still providing the same behaviour in the vast majority of common cases.
1. For the efficiency-conscious: the ever-watchful ariels was kind enough to point out a far nicer algorithm for doing this.