Subject: Absolute symlinks removed from 2.11 hierarchy (#389)
Index:	bin,usr.bin,ucb,doc,.../ 2.11BSD

Description:
	Absolute symlinks (those rooted at '/') are present in the system
	and cause problems when a 2.11 system is stored as a directory
	hierarchy on another system or disk.

Repeat-By:
	Copy /usr from a 2.11BSD system to another system (after making sure
	that rsh permissions are correct and /packages/2.11/usr exists on
	the remote system):

	cd /usr
	tar -cf - . | rsh remotesystem "cd /packages/2.11/usr; tar -xpf -"

	Then try to refer to /packages/2.11/usr/src/libexec/ftpd/glob.c

	One of two things will happen:

	1) You will get a "no such file" error

	2) If the file exists it will be that of the 'remotesys' not the
	   2.11BSD version.

	The error or mistaken reference is due to the fact that '.../glob.c'
	is a symlink to /usr/src/libexec/ftpd/glob.c.

Fix:
	The problem with Absolute symlinks is that they refer to a file
	outside the 2.11 hierarchy when a 2.11 system is stored under a
	directory other than '/'.

	There were 26 absolute symlinks present in the system.  The fix
	is to remove them and substitute relative symlinks.

	Thus the symlink in the example above should have been

		../../ucb/ftp/glob.c

	which would have resolved to /packages/2.11/usr/src/ucb/ftp/glob.c,
	a path within the 2.11 source tree.

	There were a small number of Makefiles which needed to be fixed
	so as to not install programs (games mostly) or the termcap file
	as absolute symlinks.

	The shar file below contains two items:

	1) A shell script to perform the removal of the 26 absolute symlinks
	   and recreate them as relative symlinks.

	2) A patch file which updates the Makefiles.

	To install this update cut where indicated and save to a file 
	(/tmp/389).  Then:

		cd /tmp
		sh 389
		chmod 755 389.sh
		./389.sh /
		patch -p0 < 389.patch
		cd /usr/src/local/mp
		make 
		make install
		make clean

	The shell script (389.sh) MUST have an argument which is the root
	directory to cd to before performing the rm and ln commands.  FOR
	A NATIVE 2.11BSD system the argument to 389.sh is "/".  If you have
	stored a copy of 2.11 on another system under a directory other than
	/ then you would specify that directory as the argument to 389.sh.

	That's all.

	As always this and previous updates to 2.11BSD are available via
	anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the
	directory /pub/2.11BSD.

===========================cut here===========================
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	389.sh
#	389.patch
# This archive created: Wed Sep 24 21:32:02 1997
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f '389.sh'
then
	echo shar: "will not over-write existing file '389.sh'"
else
sed 's/^V//' << \SHAR_EOF > '389.sh'
V#!/bin/sh
V
Vif [ $# != 1 ]; then
V	echo "usage: 389.sh root_directory"
V	echo " On a native 2.11BSD system root_directory is /"
V	echo " If a 2.11BSD system is stored on foreign system in "
V	echo " a directory such as/packages/2.11 then"
V	echo " root_directory would be /packages/2.11"
V	exit 1
Vfi
V
Vecho "Root directory being used is: " $1
Vecho -n " Is this OK? <y|n>: "
Vread answer
V
Vif [ $answer != "y" ]; then
V	exit 1
Vfi
V
Vif [ ! -d $1 ]; then
V	echo "$1 is not a directory"
V	exit 1
Vfi
V
Vcd $1
V
V# Turn off the exit-on-error flag - if some of the symlinks below do not exist
V# that is not a fatal error because they will be recreated.
V
Vset +e
Vset -x
V
Vrm bin/sort
Vrm etc/termcap
Vrm etc/crash
Vrm sys
Vrm usr/bin/newaliases
Vrm usr/bin/mailq
Vrm usr/doc/ps1/13.rcs/man
Vrm usr/doc/ps2/10.ingres
Vrm usr/doc/usd/17.jove/jove.1
Vrm usr/doc/usd/17.jove/jove.2
Vrm usr/doc/usd/17.jove/jove.3
Vrm usr/doc/usd/17.jove/jove.4
Vrm usr/doc/usd/17.jove/jove.5
Vrm usr/games/phantasia
Vrm usr/include/net
Vrm usr/include/netimp
Vrm usr/include/netinet
Vrm usr/include/netns
Vrm usr/include/stand
Vrm usr/include/pdp
Vrm usr/include/sys
Vrm usr/include/pdpif
Vrm usr/include/pdpuba
Vrm usr/include/pdpmba
Vrm usr/include/vaxuba
Vrm usr/src/libexec/ftpd/glob.c
V
Vln -s ../usr/bin/sort  bin/sort
Vln -s ../usr/share/misc/termcap  etc/termcap
Vln -s ../usr/crash  etc/crash
Vln -s usr/src/sys  sys
Vln -s ../sbin/sendmail  usr/bin/newaliases
Vln -s ../sbin/sendmail  usr/bin/mailq
Vln -s ../../../src/new/rcs/man  usr/doc/ps1/13.rcs/man
Vln -s ../../ingres/doc  usr/doc/ps2/10.ingres
Vln -s ../../../src/new/jove/doc/jove.1  usr/doc/usd/17.jove/jove.1
Vln -s ../../../src/new/jove/doc/jove.2  usr/doc/usd/17.jove/jove.2
Vln -s ../../../src/new/jove/doc/jove.3  usr/doc/usd/17.jove/jove.3
Vln -s ../../../src/new/jove/doc/jove.4  usr/doc/usd/17.jove/jove.4
Vln -s ../../../src/new/jove/doc/jove.5  usr/doc/usd/17.jove/jove.5
Vln -s lib/phantasia/phantasia  usr/games/phantasia
Vln -s ../../sys/net  usr/include/net
Vln -s ../../sys/netimp  usr/include/netimp
Vln -s ../../sys/netinet  usr/include/netinet
Vln -s ../../sys/netns  usr/include/netns
Vln -s ../../sys/pdpstand  usr/include/stand
Vln -s ../../sys/pdp  usr/include/pdp
Vln -s ../../sys/h  usr/include/sys
Vln -s ../../sys/pdpif  usr/include/pdpif
Vln -s ../../sys/pdpuba  usr/include/pdpuba
Vln -s ../../sys/pdpmba  usr/include/pdpmba
Vln -s ../../sys/vaxuba  usr/include/vaxuba
Vln -s ../../ucb/ftp/glob.c  usr/src/libexec/ftpd/glob.c
V
Vexit 0
SHAR_EOF
chmod 755 '389.sh'
fi
if test -f '389.patch'
then
	echo shar: "will not over-write existing file '389.patch'"
else
sed 's/^V//' << \SHAR_EOF > '389.patch'
V*** /usr/include/Makefile.old	Thu Oct 21 21:08:59 1993
V--- /usr/include/Makefile	Mon Sep 22 22:53:28 1997
V***************
V*** 3,9 ****
V  # All rights reserved.  The Berkeley software License Agreement
V  # specifies the terms and conditions for redistribution.
V  #
V! #	@(#)Makefile	5.16 (2.11BSD GTE) 10/21/93
V  #
V  # Doing a make install builds /usr/include
V  #
V--- 3,9 ----
V  # All rights reserved.  The Berkeley software License Agreement
V  # specifies the terms and conditions for redistribution.
V  #
V! #	@(#)Makefile	5.16.1 (2.11BSD GTE) 1997/9/22
V  #
V  # Doing a make install builds /usr/include
V  #
V***************
V*** 17,23 ****
V  # follow symbolic links.
V  #
V  DESTDIR=
V- TOPDIR=
V  SUBDIRS=arpa pascal protocols OLD
V  STD=	a.out.h ar.h assert.h ctype.h curses.h disktab.h fcntl.h \
V  	fstab.h grp.h lastlog.h math.h memory.h mp.h mtab.h ndbm.h \
V--- 17,22 ----
V***************
V*** 57,63 ****
V  		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
V  	done
V  	rm -f ${DESTDIR}/usr/include/machine
V! 	ln -s ./${MACHINE} ${DESTDIR}/usr/include/machine
V  	rm -f ${DESTDIR}/usr/include/frame.h
V  	ln -s machine/frame.h ${DESTDIR}/usr/include/frame.h
V  
V--- 56,62 ----
V  		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
V  	done
V  	rm -f ${DESTDIR}/usr/include/machine
V! 	ln -s ${MACHINE} ${DESTDIR}/usr/include/machine
V  	rm -f ${DESTDIR}/usr/include/frame.h
V  	ln -s machine/frame.h ${DESTDIR}/usr/include/frame.h
V  
V***************
V*** 66,72 ****
V  		rm -rf ${DESTDIR}/usr/include/$$i; \
V  		if [ ! -s ${DESTDIR}/usr/include/$$i ]; \
V  		then \
V! 			ln -s ${TOPDIR}/sys/$$i ${DESTDIR}/usr/include/$$i; \
V  		else \
V  			echo ${DESTDIR}/usr/include/$$i not removed; \
V  		fi; \
V--- 65,71 ----
V  		rm -rf ${DESTDIR}/usr/include/$$i; \
V  		if [ ! -s ${DESTDIR}/usr/include/$$i ]; \
V  		then \
V! 			ln -s ../../sys/$$i ${DESTDIR}/usr/include/$$i; \
V  		else \
V  			echo ${DESTDIR}/usr/include/$$i not removed; \
V  		fi; \
V***************
V*** 74,80 ****
V  	rm -rf ${DESTDIR}/usr/include/sys
V  	-if [ ! -s ${DESTDIR}/usr/include/sys ]; \
V  	then \
V! 		ln -s ${TOPDIR}/sys/h ${DESTDIR}/usr/include/sys; \
V  	else \
V  		echo ${DESTDIR}/usr/include/sys not removed; \
V  	fi
V--- 73,79 ----
V  	rm -rf ${DESTDIR}/usr/include/sys
V  	-if [ ! -s ${DESTDIR}/usr/include/sys ]; \
V  	then \
V! 		ln -s ../../sys/h ${DESTDIR}/usr/include/sys; \
V  	else \
V  		echo ${DESTDIR}/usr/include/sys not removed; \
V  	fi
V*** /usr/src/include/Makefile.old	Thu Oct 21 21:08:59 1993
V--- /usr/src/include/Makefile	Mon Sep 22 22:53:28 1997
V***************
V*** 3,9 ****
V  # All rights reserved.  The Berkeley software License Agreement
V  # specifies the terms and conditions for redistribution.
V  #
V! #	@(#)Makefile	5.16 (2.11BSD GTE) 10/21/93
V  #
V  # Doing a make install builds /usr/include
V  #
V--- 3,9 ----
V  # All rights reserved.  The Berkeley software License Agreement
V  # specifies the terms and conditions for redistribution.
V  #
V! #	@(#)Makefile	5.16.1 (2.11BSD GTE) 1997/9/22
V  #
V  # Doing a make install builds /usr/include
V  #
V***************
V*** 17,23 ****
V  # follow symbolic links.
V  #
V  DESTDIR=
V- TOPDIR=
V  SUBDIRS=arpa pascal protocols OLD
V  STD=	a.out.h ar.h assert.h ctype.h curses.h disktab.h fcntl.h \
V  	fstab.h grp.h lastlog.h math.h memory.h mp.h mtab.h ndbm.h \
V--- 17,22 ----
V***************
V*** 57,63 ****
V  		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
V  	done
V  	rm -f ${DESTDIR}/usr/include/machine
V! 	ln -s ./${MACHINE} ${DESTDIR}/usr/include/machine
V  	rm -f ${DESTDIR}/usr/include/frame.h
V  	ln -s machine/frame.h ${DESTDIR}/usr/include/frame.h
V  
V--- 56,62 ----
V  		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
V  	done
V  	rm -f ${DESTDIR}/usr/include/machine
V! 	ln -s ${MACHINE} ${DESTDIR}/usr/include/machine
V  	rm -f ${DESTDIR}/usr/include/frame.h
V  	ln -s machine/frame.h ${DESTDIR}/usr/include/frame.h
V  
V***************
V*** 66,72 ****
V  		rm -rf ${DESTDIR}/usr/include/$$i; \
V  		if [ ! -s ${DESTDIR}/usr/include/$$i ]; \
V  		then \
V! 			ln -s ${TOPDIR}/sys/$$i ${DESTDIR}/usr/include/$$i; \
V  		else \
V  			echo ${DESTDIR}/usr/include/$$i not removed; \
V  		fi; \
V--- 65,71 ----
V  		rm -rf ${DESTDIR}/usr/include/$$i; \
V  		if [ ! -s ${DESTDIR}/usr/include/$$i ]; \
V  		then \
V! 			ln -s ../../sys/$$i ${DESTDIR}/usr/include/$$i; \
V  		else \
V  			echo ${DESTDIR}/usr/include/$$i not removed; \
V  		fi; \
V***************
V*** 74,80 ****
V  	rm -rf ${DESTDIR}/usr/include/sys
V  	-if [ ! -s ${DESTDIR}/usr/include/sys ]; \
V  	then \
V! 		ln -s ${TOPDIR}/sys/h ${DESTDIR}/usr/include/sys; \
V  	else \
V  		echo ${DESTDIR}/usr/include/sys not removed; \
V  	fi
V--- 73,79 ----
V  	rm -rf ${DESTDIR}/usr/include/sys
V  	-if [ ! -s ${DESTDIR}/usr/include/sys ]; \
V  	then \
V! 		ln -s ../../sys/h ${DESTDIR}/usr/include/sys; \
V  	else \
V  		echo ${DESTDIR}/usr/include/sys not removed; \
V  	fi
V*** /usr/src/include/Makefile.install.old	Fri Jan  6 08:40:16 1989
V--- /usr/src/include/Makefile.install	Mon Sep 22 22:59:54 1997
V***************
V*** 30,39 ****
V  symlinks:
V  	for i in ${SYSDIRS}; do \
V  		rm -rf $$i; \
V! 		ln -s ${SYS}/$$i $$i; \
V  	done
V  	rm -rf sys
V! 	ln -s ${SYS}/h sys
V  
V  copies:
V  	-for i in ${SYSDIRS}; do \
V--- 30,39 ----
V  symlinks:
V  	for i in ${SYSDIRS}; do \
V  		rm -rf $$i; \
V! 		ln -s ../../${SYS}/$$i $$i; \
V  	done
V  	rm -rf sys
V! 	ln -s ../../${SYS}/h sys
V  
V  copies:
V  	-for i in ${SYSDIRS}; do \
V*** /usr/src/games/phantasia/Makefile.old	Sun Jan 28 01:32:05 1996
V--- /usr/src/games/phantasia/Makefile	Mon Sep 22 22:50:51 1997
V***************
V*** 1,4 ****
V! # Makefile for Phantasia 3.2 (1.1 2.11BSD - 1996/1/28)
V  #
V  # MODIFIED TO COMPILE WITHOUT 'XSTR'.
V  #
V--- 1,4 ----
V! # Makefile for Phantasia 3.2 (1.2 2.11BSD - 1997/9/22)
V  #
V  # MODIFIED TO COMPILE WITHOUT 'XSTR'.
V  #
V***************
V*** 21,26 ****
V--- 21,27 ----
V  DESTDIR=
V  
V  # DEST is where the program and its support files reside
V+ #   If this changes then the symbolic link in the 'install' target must change.
V  DEST =		/usr/games/lib/phantasia
V  
V  # The following are program constants which are implementation dependent.
V***************
V*** 93,101 ****
V  phant.help:	phant.nr
V  		tbl -TX phant.nr | nroff -man -Ttn300 > phant.help
V  
V  install:	all phantasia.0
V  	rm -f ${DESTDIR}/usr/games/phantasia
V! 	ln -s ${DESTDIR}${DEST}/phantasia ${DESTDIR}/usr/games/phantasia
V  	-mkdir ${DESTDIR}${DEST}
V  	cp phantasia monsters phant.help ${DESTDIR}${DEST}
V  	chmod 755 ${DESTDIR}${DEST}
V--- 94,105 ----
V  phant.help:	phant.nr
V  		tbl -TX phant.nr | nroff -man -Ttn300 > phant.help
V  
V+ # DO NOT use an absolute pathname in the symbolic link below.  Figure out
V+ #   what the relative path is.
V+ 
V  install:	all phantasia.0
V  	rm -f ${DESTDIR}/usr/games/phantasia
V! 	ln -s lib/phantasia/phantasia ${DESTDIR}/usr/games/phantasia
V  	-mkdir ${DESTDIR}${DEST}
V  	cp phantasia monsters phant.help ${DESTDIR}${DEST}
V  	chmod 755 ${DESTDIR}${DEST}
V*** /usr/src/local/mp/Makefile.old	Wed Mar 20 19:59:50 1996
V--- /usr/src/local/mp/Makefile	Mon Sep 22 20:36:53 1997
V***************
V*** 163,169 ****
V  	   -@for name in $(MAILPNAMES); do \
V  		echo -n $$name " "; \
V  		rm -f $(MPBINDIR)/$$name; \
V! 		ln -s $(MPBINDIR)/mailp $(MPBINDIR)/$$name; \
V  	   done
V  	   @echo
V  
V--- 163,169 ----
V  	   -@for name in $(MAILPNAMES); do \
V  		echo -n $$name " "; \
V  		rm -f $(MPBINDIR)/$$name; \
V! 		ln $(MPBINDIR)/mailp $(MPBINDIR)/$$name; \
V  	   done
V  	   @echo
V  
V*** /usr/src/share/termcap/Makefile.old	Sun Dec  1 16:56:15 1996
V--- /usr/src/share/termcap/Makefile	Mon Sep 22 22:44:51 1997
V***************
V*** 3,9 ****
V  # All rights reserved.  The Berkeley software License Agreement
V  # specifies the terms and conditions for redistribution.
V  #
V! #	@(#)Makefile	5.2.3 (2.11BSD GTE) 1996/12/1
V  #
V  # reorder gives an editor command for most common terminals
V  # (in reverse order from n'th to 1'st most commonly used)
V--- 3,9 ----
V  # All rights reserved.  The Berkeley software License Agreement
V  # specifies the terms and conditions for redistribution.
V  #
V! #	@(#)Makefile	5.2.4 (2.11BSD GTE) 1997/9/22
V  #
V  # reorder gives an editor command for most common terminals
V  # (in reverse order from n'th to 1'st most commonly used)
V***************
V*** 17,24 ****
V  install: termcap tabset map3270
V  	install -c -m 444 termcap ${DESTDIR}/usr/share/misc/termcap
V  	rm -f ${DESTDIR}/etc/termcap
V! 	ln -s /usr/share/misc/termcap ${DESTDIR}/etc/termcap
V! 	install -c -m 444 map3270 /usr/share/misc/map3270
V  
V  tabset: FRC
V  	rm -fr ${DESTDIR}/usr/share/tabset
V--- 17,24 ----
V  install: termcap tabset map3270
V  	install -c -m 444 termcap ${DESTDIR}/usr/share/misc/termcap
V  	rm -f ${DESTDIR}/etc/termcap
V! 	ln -s ../usr/share/misc/termcap ${DESTDIR}/etc/termcap
V! 	install -c -m 444 map3270 ${DESTDIR}/usr/share/misc/map3270
V  
V  tabset: FRC
V  	rm -fr ${DESTDIR}/usr/share/tabset
V*** /usr/src/usr.sbin/sendmail/Makefile.old	Mon Oct 28 23:13:35 1996
V--- /usr/src/usr.sbin/sendmail/Makefile	Mon Sep 22 23:01:40 1997
V***************
V*** 1,7 ****
V  #
V  #	Makefile for sendmail base directory
V  #
V! #		@(#)Makefile	4.9.1	(2.11BSD) 1996/10/24
V  #
V  
V  ALL=	src/sendmail
V--- 1,7 ----
V  #
V  #	Makefile for sendmail base directory
V  #
V! #		@(#)Makefile	4.9.2	(2.11BSD) 1997/9/22
V  #
V  
V  ALL=	src/sendmail
V***************
V*** 33,41 ****
V  	install -c -o root -m 666	/dev/null	$(STATUSFILE)
V  	install -c -o root -m 644	/dev/null	$(FROZENFILE)
V  	rm -f					$(DESTDIR)/usr/bin/newaliases
V! 	$(LN)			/usr/sbin/sendmail $(DESTDIR)/usr/bin/newaliases
V  	rm -f					$(DESTDIR)/usr/bin/mailq
V! 	$(LN)			/usr/sbin/sendmail  $(DESTDIR)/usr/bin/mailq
V  
V  src/sendmail:
V  	cd src; make ${MFLAGS} sendmail
V--- 33,41 ----
V  	install -c -o root -m 666	/dev/null	$(STATUSFILE)
V  	install -c -o root -m 644	/dev/null	$(FROZENFILE)
V  	rm -f					$(DESTDIR)/usr/bin/newaliases
V! 	$(LN)			../sbin/sendmail $(DESTDIR)/usr/bin/newaliases
V  	rm -f					$(DESTDIR)/usr/bin/mailq
V! 	$(LN)			../sbin/sendmail  $(DESTDIR)/usr/bin/mailq
V  
V  src/sendmail:
V  	cd src; make ${MFLAGS} sendmail
V*** /usr/src/usr.sbin/sendmail.MX/src/Makefile.old	Thu Oct 24 20:26:47 1996
V--- /usr/src/usr.sbin/sendmail.MX/src/Makefile	Mon Sep 22 23:03:06 1997
V***************
V*** 63,71 ****
V  	install -c -o bin -m 644 /dev/null ${DESTDIR}/etc/sendmail.fc
V  	install -c -o bin -m 666 /dev/null ${DESTDIR}/var/log/sendmail.st
V  	rm -f ${DESTDIR}/usr/bin/newaliases
V! 	ln -s ${DESTDIR}/usr/sbin/sendmail ${DESTDIR}/usr/bin/newaliases
V  	rm -f ${DESTDIR}/usr/bin/mailq
V! 	ln -s ${DESTDIR}/usr/sbin/sendmail ${DESTDIR}/usr/bin/mailq
V  	-if [ -s sendmail.sr ]; then \
V  		install -c -o bin -m 644 sendmail.sr \
V  			$(DESTDIR)/usr/share/misc/sendmail.sr; \
V--- 63,71 ----
V  	install -c -o bin -m 644 /dev/null ${DESTDIR}/etc/sendmail.fc
V  	install -c -o bin -m 666 /dev/null ${DESTDIR}/var/log/sendmail.st
V  	rm -f ${DESTDIR}/usr/bin/newaliases
V! 	ln -s ../sbin/sendmail ${DESTDIR}/usr/bin/newaliases
V  	rm -f ${DESTDIR}/usr/bin/mailq
V! 	ln -s ../sbin/sendmail ${DESTDIR}/usr/bin/mailq
V  	-if [ -s sendmail.sr ]; then \
V  		install -c -o bin -m 644 sendmail.sr \
V  			$(DESTDIR)/usr/share/misc/sendmail.sr; \
V*** /VERSION.old	Thu Sep 11 21:14:27 1997
V--- /VERSION	Wed Sep 24 19:57:13 1997
V***************
V*** 1,5 ****
V! Current Patch Level: 388
V! Date: September 12, 1997
V  
V  2.11 BSD
V  ============
V--- 1,5 ----
V! Current Patch Level: 389
V! Date: September 24, 1997
V  
V  2.11 BSD
V  ============
SHAR_EOF
chmod 644 '389.patch'
fi
exit 0
#	End of shell archive
