This patch is for 3.3, but also applies to 3.2 & 2.2.8 A similar patch (with no accompanying comment) is in ../../../../../OpenBSD/src/gen/sys/sys/param.h.diff Later perhaps I could try leaving it at the default value, but doubling it via `sysctl` ? To: jhs@ From: gnats-admin@_ERASE_FreeBSD.org Subject: Re: bin/12634: MAXSYMLINKS correct lib/libc/sys/intro.2 double sys/sys/param.h Thank you very much for your problem report. It has the internal identification `bin/12634'. The individual assigned to look at your report is: freebsd-bugs. >Category: bin >Responsible: freebsd-bugs >Synopsis: patch MAXSYMLINKS to correct intro.2 & double param.h >Arrival-Date: Tue Jul 13 16:10:01 PDT 1999 Subject: MAXSYMLINKS correct lib/libc/sys/intro.2 double sys/sys/param.h >Submitter-Id: current-users >Originator: Julian H. Stacey jhs@ >Confidential: no >Synopsis: patch MAXSYMLINKS to correct intro.2 & double param.h >Severity: non-critical >Priority: medium >Category: bin >Release: FreeBSD 3.2-RELEASE i386 >Class: change-request >Environment: I hit the MAXSYMLINKS 32 barrier, so doubled it, to allow for larger NFS networks of file systems. It should have no appreciable effect on others, except a slightly longer pause before reporting error, when recursive looping on a bad symbolic link. I also noticed man 2 intro was previously wrong & corrected it. >Description: I run a site of 10 hosts with many ports distfiles, NFS mounted on other hosts. Here's my actual example of how I hit the barrier, shown so folk won't think it's a contrived amount of links, it's simply my current site's NFS file system) : DIRECTORY SYMBOLIC LINK (or file, in last line) /usr ports -> /host/park/usr/ports /host park -> /a/park /a/park/usr/ports distfiles@ -> /pub/freebsd/distfiles/links / pub -> public / public -> site/public /site public -> domain/public /site/domain public -> this/public /site/domain this -> js.berklix.net /site/domain/js.berklix.net public -> ../../../host/flip/usr2/public /host flip -> /a/flip /a/flip/usr2 public@ -> ftp/public /a/flip/usr2/ftp/public/freebsd/distfiles/links/ gv-3.5.8.tar.gz -> /usr/ports/distfiles/cd.3.2/./gv-3.5.8.tar.gz /usr ports -> /host/park/usr/ports /host park -> /a/park /a/park/usr/ports distfiles@ -> /pub/freebsd/distfiles/links / pub -> public / public -> site/public /site public -> domain/public /site/domain public -> this/public /site/domain this -> js.berklix.net /site/domain/js.berklix.net public -> ../../../host/flip/usr2/public /host flip -> /a/flip /a/flip/usr2 public@ -> ftp/public /a/flip/usr2/ftp/public/freebsd/distfiles/links/ cd.3.2 ../cd.3.2 /a/flip/usr2/ftp/public/freebsd/distfiles 3.2-RELEASE/links /a/flip/usr2/ftp/public/freebsd/distfiles/3.2-RELEASE/links gv-3.5.8.tar.gz@ -> ../d4/gv-3.5.8.tar.gz /a/flip/usr2/ftp/public/freebsd/distfiles/3.2-RELEASE d4 -> link/d4 /a/flip/usr2/ftp/public/freebsd/distfiles/3.2-RELEASE link -> link.flip /a/flip/usr2/ftp/public/freebsd/distfiles/3.2-RELEASE link.flip -> ../../../../../../usr1/ftp/public/freebsd/ref/3.2-RELEASE/distfiles /a/flip/usr1/ftp/public/freebsd/ref/3.2-RELEASE/distfiles/d4 gv-3.5.8.tar.gz [ The real file ] >How-To-Repeat: I hit the problem doing md5 /usr/ports/distfiles/gv-3.5.8.tar.gz with the above set of links. >Fix: *** old/src/sys/sys/param.h Sat May 8 23:55:42 1999 --- new/src/sys/sys/param.h Tue Jul 13 23:10:21 1999 *************** *** 168,174 **** * infinite loops reasonably quickly. */ #define MAXPATHLEN PATH_MAX ! #define MAXSYMLINKS 32 /* Bit map related macros. */ #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) --- 168,174 ---- * infinite loops reasonably quickly. */ #define MAXPATHLEN PATH_MAX ! #define MAXSYMLINKS 64 /* Bit map related macros. */ #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) Having searched all files in /usr/src for sysparam.h, I found just: sys/i386/boot/dosboot/fbsdboot.mak sys/i386/boot/dosboot/param.h:#include "sysparam.h" & both had Control Ms in (for Dos), it thus seems highly likely this quote "A path name lookup involved more than 8 symbolic links." was never correct, it should have read "32", & I've now increased it. # *** 3.2-RELEASE/src/lib/libc/sys/intro.2 Fri Mar 12 11:50:36 1999 # --- new/src/lib/libc/sys/intro.2 Tue Jul 13 23:44:18 1999 # *************** # *** 351,357 **** # refused it. This usually results from trying to connect # to a service that is inactive on the foreign host. # .It Er 62 ELOOP Em "Too many levels of symbolic links" . # ! A path name lookup involved more than 8 symbolic links. # .It Er 63 ENAMETOOLONG Em "File name too long" . # A component of a path name exceeded 255 # .Pq Dv MAXNAMELEN # --- 351,358 ---- # refused it. This usually results from trying to connect # to a service that is inactive on the foreign host. # .It Er 62 ELOOP Em "Too many levels of symbolic links" . # ! A path name lookup involved more than 64 symbolic links (from MAXSYMLINKS in # ! /usr/include/sys/param.h from src/sys/sys/param.h ). # .It Er 63 ENAMETOOLONG Em "File name too long" . # A component of a path name exceeded 255 # .Pq Dv MAXNAMELEN *** 3.3-RELEASE/src/lib/libc/sys/intro.2 Sat Jul 24 18:52:12 1999 --- new-jhs/src/lib/libc/sys/intro.2 Mon Sep 20 12:40:29 1999 *************** *** 351,358 **** refused it. This usually results from trying to connect to a service that is inactive on the foreign host. .It Er 62 ELOOP Em "Too many levels of symbolic links" . ! A path name lookup involved more than 32 .Pq Dv MAXSYMLINKS symbolic links. .It Er 63 ENAMETOOLONG Em "File name too long" . A component of a path name exceeded 255 --- 351,359 ---- refused it. This usually results from trying to connect to a service that is inactive on the foreign host. .It Er 62 ELOOP Em "Too many levels of symbolic links" . ! A path name lookup involved more than 64 .Pq Dv MAXSYMLINKS + (from /usr/include/sys/param.h from src/sys/sys/param.h) symbolic links. .It Er 63 ENAMETOOLONG Em "File name too long" . A component of a path name exceeded 255 Background Info: --- These can probably stay unchanged: sys/i386/boot/dosboot/sysparam.h:172 #define MAXSYMLINKS 8 gnu/usr.bin/rcs/lib/conf.h:46 #if has_readlink && !defined(MAXSYMLINKS) # if has_sys_param_h # include # endif # ifndef MAXSYMLINKS # define MAXSYMLINKS 20 /* BSD; not standard yet */ # endif #endif These use MAXSYMLINKS: gnu/usr.bin/rcs/lib/rcsedit.c resolve_symlink(L) lib/libc/stdlib/realpath.c: realpath(path, resolved) lib/libstand/nfs.c: nfs_open(upath, f) lib/libstand/ufs.c: ufs_open(upath, f) sys/kern/vfs_lookup.c: namei(ndp) sys/nfs/nfs_subs.c: nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag) These use ELOOP: lib/libc/gen/errlst.c:114 "Too many levels of symbolic links" lib/libc/gen/exec.c:275 case ELOOP: lib/libc/sys/intro.2:354 A path name lookup involved more than 8 symbolic links. share/examples/mdoc/example.3: Too many levels of symbolic links. sys/sys/errno.h: #define ELOOP 62 lib/libc/stdlib/realpath.c if (++symlinks > MAXSYMLINKS) ) )