[comp.unix.questions] Levels of soft links in BSD4.3

irick@ecn.purdue.edu (GarBear Irick) (09/04/90)

Just curious....  Does anyone know how many levels of soft links I can use
in 4.3BSD?  Something like

lns -s ONE TWO
lns -s TWO ONE
cat ONE

gives the "too many levels of symbolic links" message.  How far can we go???

-- 
Gary A. Irick,  Purdue University |
INTERNET: irick@en.ecn.purdue.edu |
UUCP:     ...!pur-ee!irick        |

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (09/04/90)

In article <1990Sep4.045427.2307@ecn.purdue.edu> irick@ecn.purdue.edu (GarBear Irick) writes:
> Just curious....  Does anyone know how many levels of soft links I can use
> in 4.3BSD?

20.

  [ ln -s ONE TWO; ln -s TWO ONE ]

Infinity is larger than 20.

---Dan

cpcahil@virtech.uucp (Conor P. Cahill) (09/04/90)

In article <1990Sep4.045427.2307@ecn.purdue.edu> irick@ecn.purdue.edu (GarBear Irick) writes:
>
>Just curious....  Does anyone know how many levels of soft links I can use
>in 4.3BSD?  Something like

A quick RTFM of the 4.3BSD Programmers manual reference guide states the 
following (on the intro(2) manual page):

	62 ELOOP too many levels of symbolic links
		A path name lookup involved more than 8 symbolic links

This code is in place to protect the system from the case you attempted to
create:

>lns -s ONE TWO
>lns -s TWO ONE
>cat ONE

which otherwise would have gone on forever.
-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 

guy@auspex.auspex.com (Guy Harris) (09/05/90)

>Just curious....  Does anyone know how many levels of soft links I can use
>in 4.3BSD?

MAXSYMLINKS is 8, so it's about 8 levels in 4.3BSD and 4.3-tahoe.  The
number was cranked up to 20 in SunOS, and possibly in other systems that
picked up the BSD code from Sun (it's probably 20 or more in S5R4 as
well).

>lns -s ONE TWO
>lns -s TWO ONE
>cat ONE
>
>gives the "too many levels of symbolic links" message.

Not surprising, considering that it has, in effect, an *infinite* number
of symbolic links....

jeff@onion.pdx.com (Jeff Beadles) (09/06/90)

irick@ecn.purdue.edu (GarBear Irick) writes:

>Just curious....  Does anyone know how many levels of soft links I can use
>in 4.3BSD?  Something like

Well, it can be configured by whomever builds the kernel.  On the 4.2 BSD
system here, it's 20.  (in h/param.h, #define MAXSYMLINKS 20)

Your mileage may vary.

(Un?)fortunatly, the kernel code does not set this a variable that can be used.
They just check against the define.  (ie: if (++nlink > MAXSYMLINKS) { ... })

	-Jeff
-- 
Jeff Beadles  jeff@onion.pdx.com  jeff@quark.wv.tek.com