Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jul 1999 22:40:33 GMT
From:      jhs@FreeBSD.ORG
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/12634: MAXSYMLINKS correct lib/libc/sys/intro.2 double sys/sys/param.h
Message-ID:  <199907132240.WAA24480@jhs.muc.de>

next in thread | raw e-mail | index | archive | help

>Number:         12634
>Category:       bin
>Synopsis:       patch MAXSYMLINKS to correct intro.2 & double param.h
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 13 16:10:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Julian H. Stacey jhs@freebsd.org
>Release:        FreeBSD 3.2-RELEASE i386
>Organization:
>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 -> jhs.no_domain
  /site/domain/jhs.no_domain	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 -> jhs.no_domain
  /site/domain/jhs.no_domain	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.

*** old/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

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 <sys/param.h>
		#	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)
	) )


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907132240.WAA24480>