Subject: 35th Anniversary Edition (#500) Index: many Description: 2.11BSD release was announced in January 1991. May 4 1991 saw patch #1 posted to Usenet. It is with great pleasure, after 499 patches, to announce in 2026 the release of "2.11BSD 35th Anniversary Edition". The plan was this patch, #500, would be only updated installation documentation, an updated /VERSION and some nice words announcing the offical release of a new bare metal install tape PLUS sanctioned pre- configured disk images. The poet Robert Burns summed up the change of plans with: "The best laid plans of mice and men oft go awry". The submission of improvements and fixes continued. Rather than a release immediately followed by #501, 502, ... the decision was made to delay the release and add more and more to patch #500. This patch will transform a #499 system to Patch Level 500 which is the initial release of "2.11BSD 35th Anniversary Edition". MANY people have contributed over the years. Attempting to list all the contributors would be futile. Credit has been given in the patches as they were published - thank you to everyone! Thirty five years ago the thought was 2.11BSD would fade into the dustbin of history very quickly. Rather than fade away the system is more popular than ever. XXXXXXXXXX Offical bootable tape image used for bare metal installation is available from TUHSI (The Unix Heritage Society Inc.): https://www.tuhs.org/Archive/Distributions/UCB/2BSD/2.11BSD-PL500 Sanctioned pre-configured disk images have been prepared from the official bootable tape distribution. The first image is for a PDP-11/70 system with classic MASSBUS peripherals, upgraded with an Ethernet controller and a modern terminal multiplexor. It supports the following hardware: PDP-11/70 CPU with 4MB of main memory and floating point processor Console terminal RM05 disk drive (quantity 4) TU77 tape drive DELUA Ethernet controller DHU11 16-port terminal multiplexor LP11 line printer It is supplied and maintained by Terri Kennedy, terri-decus@glaver.org and can be downloaded from: https://www.glaver.org/PiDP-11/tk2bsd/Generic-211BSD.tgz (or .zip) The second image FIXME BQT image description and location XXXXXXXXXX 1) "ls -l" shows different date/time information depending on the age of the file. Files over 6 months old show "month day year" while other files show "month day hour:minute". 2) touch(1) does not support "-r" to use timestamp from an existing file or "-t" to use a user specified timestamp. 3) "sysctl vm.nswap" does not display the amount of swap space available 4) src/usr.bin/xinstall/xinstall.c has needless __STDC__ conditionals 5) src/ucb/pascal/pxp/Makefile and src/usr.bin/neqn/Makefile.old have incomplete clean: targets. "make clean" leaves executables and object files behind 6) tftp, tn3270, lpc, learn, banner, warp, mille, sail, nstest, timedc and btlgammon use gets() which is insecure and a warning message will be printed when the programs are run. 7) During patch #499 cruft was not removed from usr/src/libexec/tcpd 8) pstat(8) manpage references information not present in 2.11BSD 9) mkdir does not support the -m option to set the directory mode. 10) src/usr.bin/refer has two unused .c files and the Makefile contains targets for programs which are not installed. 'whatabout' was initially uncompilable (ancient C constructs used). Not worth fixing the compile issue because the program depends on files not present in /usr/dict (and are not mentioned in dict/README). The other program (refpart) is an undocumented test version of refer. deliv1.c uses gets() which is unsafe. 'deliv' is not installed in /usr/libexec/refer. 'hunt' requires deliv as a helper program. 11) find(1) has several errors: 1) inaccessible directory in / causes find to give errors for all further files in /, 2) source errors prevented compilation if #include is added, and 3) needless #ifdef statements. 12) The user root does not have a private home directory but instead uses the system's top level directory "/". This can expose root's private information (.rhosts, shell aliases, etc) to public view. The system admin account should have the same isolation as users have from each other. 13) ctype(3) not ANSI-C compliant. C99 required headers float.h, inttypes.h, iso646.h and locale.h are missing. C99 functions imaxabs(), imaxdiv(), strtoimax(), strtoumax(), setlocale(), localeconv() are missing. stdint.h missing C99type declarations and macro definitions. C compiler does not recognize "restrict" keyword. C compiler does not handle variable declarations anywhere in a block but only at the beginning of a block 14) shar can fail to open a directory when arguments to shar are relative pathnames. shar generates a sh script that does not chdir to the correct directory after processing a directory. 15) /usr/include/OLD contained two .h files. Each .h file was not meant for public use and was used by only one program: ps (psout.h) and uucp/aculib (dk.h). 16) ifconfig (and its manpage) indicate support for trailers/-trailers 17) chown does not recognize the user:group syntax used by other systems 18) The OLD and NEW directories in /sys/pdpstand haven't been used in almost 40 years. NEW/* wouldn't build then and doesn't build today. 19) corrupt uucico is installed. acucntrl.8 is present but acucntrl.0 is not created and installed. 20) manpage for symdump(1) is missing 21) device interrupts are not counted per device but vmstat(1) has the -i option to report the counts. vmstat.c looks for vax/non-pdp11 kernel symbols (_phz for example). 22) printf(3) formatting: if a float (i.e. %f) spec is used with a fraction field width of zero and if the value to be formatted is zero the output is spaces instead of "0". 23) the kernel source directory 'src/sys/pdpmba' has nothing in it except a 'tags' symlink. 24) usr/src/sys/bootrom contains the SI9500 boot rom code which is not needed. System has the SI9500 boot block in src/sys/mdec/si95uboot.s 25) creating a distribution tape in /sys/pdpstand leaves the compiled objects, libraries and standalone executables present in the source tree. tar will include the binaries when writing usr/src/sys to tape. 26) The mtools programs use gets() which is unsafe and causes a warning message to be printed. 27) symcompact is used to compact the kernel symbol table (but may be used on any non-stripped executable with a large symbol table) so that nm(1) (and other programs) can process the file. If the kernel has many device drivers configured symcompact will fail with a no memory error. The result is an executable which can not be handled by programs such as nm(1) or adb(1). 28) Patch #499 resolved the problem of two versions of grep being present in the system by removing the version from /bin and retaining the version in /usr/ucb. This causes two problems: 1) when the system is in single user mode or if /usr is not available (either has not been mounted or not created) 'grep' can not be used and 2) the version of grep.c from src/ucb coredumps with expressions the version in src/bin handles successfully. 29) "dmesg -" gives an error creating the obsolete/outdated file /usr/adm/msgbuf 30) The find database (/var/db/find.codes) is missing the last file in / 31) src/sendmail and src/sendmail.MX both have much cruft that should have been removed eons ago. sendmail.MX, although not used in most systems, does not compile. 32) MANY source files do not properly ifdef sccsid strings resulting in wasted D space in the compiled programs. 33) manpages refer to rather than 34) fcntl.h missing prototypes for open(), fcntl(), creat() and flock() 35) While the manpage for the game 'rogue' is installed the program itself is not built or installed. 36) /usr/local/trace has no documentation, no usage message, does not display all the tracebuf[] entries, and hardcoded the frequency of printing the field title header. 37) bk.4 manpage for the Berknet protocol exists but the kernel has no support at all (never implemented). 38) Hyperchannel ("hy") is listed as a network device in the kernel configuration file but there are no supporing files (.h or .c) present in the system 39) Compiling a kernel with no MSCP ('ra) controllers produces a warning message 40) 'checksys' does not include the bounce buffer allocated when the kernel option SOFUB_MAP is enabled. That buffer must lie entirely below 256KB. SOFUB_MAP is normally only used by the GENERIC kernel and the kernel table sizes (based on MAXUSERS) must be set very small to ensure correct bounce buffer placement. 41) The Ingres database system (/usr/ingres) fails to compile. There is also cruft that should be removed. 42) a) Only the front end of sccs is present in /usr/ucb/sccs, NONE of the background programs (get, admin, ...) are present in source or manpages b) sccs incorrectly initializes the pathname member of SccsProg[] entries. 43) 'nm' accepts "-a", sets but does not use 'aflg'. The manpage makes no mention of a -a option. 44) mkproto(8) hasn't been used, that anyone can recall, since it was created in 1985. mkproto(8) can't recreate links present in the source filesystem. The maximum size of file that can be copied is less than 256KB and the destination filesystem must be newly created. 45) Files in the /usr are owned by a non existent userid (10) 46) The default disk in quot(1) is incorrect. 47) No manpage exists for strdup(3) 48) setpassent(3) is missing a manpage 49) /dev/swap must be manually created/linked in /dev rather than programs using the swap device configured into the kernel. 50) devname(3) lacks an interface to free the resources used to access the /var/run/dev DBM database. 51) if /var/run/utmp does not exist w(1) coredumps 52) programs should use the system installed include files for pathnames: utmp.h for _PATH_UTMP, paths.h for _PATH_BSHELL, etc instead of local definitions in program local pathnames.h 53) tcsh should use the system provided setenv(3) function. tcsh leaked the memory allocated for the host type (pdp11). large blocks of conditionals for obsolete platforms reduce readability and maintainability. limit command does not work. 54) snprintf(3) coredumps if the output buffer length is less than the amount of input data. 55) strftime(3) does not process '%b' correctly. This causes syslog(3) to create incorrect date strings. syslogd(8) does not see the expected date format and adds its own date string. Also no declaration is present in time.h for strftime(). 56) syslogd(8) is logging cron(8) messages in two files rather than only one file. 57) ps(1) a) uses a static array for tty devices, b) has incorrect default for crashdump memory image, c) doesn't use getopt() to process arguments 58) ntp has a Y2K bug that appears when PSTI support is enabled. 59) The change in ps(1)'s database (psdatabase) caused top(1) (which had a private copy of the structure) to fail. top(1) wasted a large amount of memory allocating memory to hold tty and kernel wait channel info that is never used. Also memory was being allocated for user process info that was not used. 60) The program crc in the zmodem source distribution is not compiled or installed. 61) w(1), top(1), ps(1), fstat(8), identd(8) have the string "/dev/swap" wired in. See (49) above. 62) When a TCP uucp client with a very long domain name connects to uucpd, uucpd crashes before the UUCP connection even starts. 63) patch(1) has code to look for and attempt to check out SCCS files. Since SCCS has never existed (and never will) on 2.11 the code and D space (for strings, messages, etc) are a waste. 64) acctd.8 misspelled the word 'receipt'. 65) Outdated 'tags' files are present in several source directories. 66) f77 generates invalid intermediate code which causes c1 (code generator) to exit with a "No code table for op" error. 67) The f77 Makefile runs the optimizer twice for each .c file. The libc function mktemp() is defined locally which conflicts with the definition in 68) mkstr(1) does not handle the alarm or vertical tab characters. '\a' and '\v' should be converted into BEL and VT respectively. 69) err(1), errx(1), etc are not prototyped. 70) Many unsupported protocol and address families (with the corresponding name strings in CTL_NET_NAMES) are present in socket.h 71) Network memory resources are exhausted by too many sockets stuck in FIN_WAIT_2 state resulting in the system being unresponsive on the network. 72) monop(6) dumps core immediately upon launch. 73) upon startup battlestar(6) prints nothing, no descriptions of rooms, objects and attempts to save the score to /usr/games/lib/x rather than /usr/games/lib/battlestar.log 74) phantasia(6) runs setuid to root rather than daemon (as other setuid games). The Makefile copies the executable to the support directory and then creates a symlink in /usr/games pointing to the executable. Three arguments were being specified to signal() rather than two. There are unused test files present the source directory. 75) efl is resource starved. Including support for gcos, crayos and unusable metering (meter()) code is wrong. 76) The network image /netnix contains a surprising amount of wasted D space. 77) The stdio function fgetln() was inadvertenly omitted in the ANSI stdio portion of patch #499. 78) With the removal of lint (in patch #499) the source directories /usr/src/lib/mip and /usr/src/lib/pcc are no longer useful (or needed). 79) F77 programs can into an endless loop requiring a kill -9 to end the process. 80) rm(1) and mv(1) do not use getopt() to parse args. 81) The F77 I/O runtime libary libI77 is completely broken for files opened with ACCESS=DIRECT 82) adb(1)'s script directory (src/share/adb) contains 4BSD scripts (PORT) that can't be used (wrong structures, kernel variables, etc). 83) memory allocated by calloc() should be released by calling free() rather than the undocumented function cfree(). 84) Setup documentation in /usr/doc/2.10/setup.2.11 is out of date poorly organized, after 499 patches contained many obsolete references, and wasn't written to offer instructions to someone not already familiar with the process of a bare metal install. Repeat-By: 1) ls -l ... drwxr-xr-x 15 sms staff 480 Oct 19 21:42 programs drwxr-xr-x 50 sms staff 1600 Mar 18 2025 scripts 2) touch -t 202602031234 foo touch: bad option -t 3) sysctl vm.nswap Use vmstat or pstat to view vm.nswap information 4) grep __STDC__ /usr/src/usr.bin/xinstall/xinstall.c 5) Observation. pxp, y.output, and neqn will remain after "make clean" 6) tftp, btlgammon, tn3270, ... warning: this program uses gets(), which is unsafe. 7) cd /usr/src/libexec/tcpd ls README.IRIX and other files should have been removed during the cleanup in #499 8) man pstat Note the mention of "RSS", "SRSS", "physical page frames", "resident set size" and so on which do NOT exist in 2.11BSD. Note also the lack of information for the fields SADDR, DADDR, and SIGM which DO exist in 2.11BSD 9) mkdir -m 750 foo mkdir: illegal option -- m usage: mkdir [-p] dirname ... 10) Observation: grep gets deliv1.c read the Makefile and note that "deliv:" target exists and will build 'deliv' but "all" and "install" ignore 'deliv'. The file kaiser.c is used by nothing: grep kaiser.c * The file types.c is used by nothing: grep types.c * 'whatabout:' exists but "make whatabout" spews errors. 'refpart:' exists and "make refpart" works but program is not installed. Read the Makefile and see that 'refpart' is created by linking the .o files from refer in a different order. 11) Have an inaccessible (by a non-root user) directory in / and do "find / -name '*.old' -print": (1) --- (as root) mkdir /root chmod 700 /root (as non-root) find / -name '*.old' -print find: bad status < /usr > find: bad status < /root.NEW > find: bad status < /disklabel > find: bad status < /netnix > find: bad status < /PATCH-LOG > OR if the mode allows 'chdir' but not reading (as root) chmod 711 root (as non-root) find / -name '*.old' -print find: cannot open < /root > find: bad status < /usr > (2) --- add "#include " around line 12 in find.c and do "make" find.c:232: warning: illegal combination of pointer and integer find.c:243: warning: mixed pointer assignment find.c:243: call does not match prototype find.c:566: warning: illegal combination of pointer and integer find.c:566: call does not match prototype find.c:1031: getuid redeclared find.c:1032: getuid prototype error find.c:1049: getgid redeclared find.c:1050: getgid prototype error this is caused by find having internal functions getgid() and getuid() which conflict with the C library functions of the same name. (3) --- grep AMES find.c grep pdp11 find.c grep SUID_PWD find.c 12) Observation. grep root /etc/passwd root:*:0:1:The Man:/:/bin/sh and ls -a / .cshrc .hushlogin .login .profile .tiprc .forward .kermrc .mailrc .rhosts Those files shouldn't be accessible/visible by non-root accounts. 13) Observation by a contributor who provided the necessary patches, new files and instructions. See Fix: 13) 14) cd / shar -pX ./usr/src/bin/nm ./usr/src/bin/tp > /tmp/foo shar: Can't open './usr/src/bin/tp' after fixing the above bug the following was encountered: create a shar file cd / shar -pX ./usr/src/bin/mkdir ./usr/src/bin/ps > /tmp/x.shar cd /tmp mkdir -p usr/src/bin sh x.shar mkdir: ./usr/src/bin/ps: No such file or directory x.shar: ./usr/src/bin/ps: bad directory 15) cd /usr/src find . -name '*.c' -print | xargs grep OLD/dk.h find . -name '*.c' -print | xargs grep OLD/psout.h ./usr.bin/uucp/aculib/dk.c:#include ./bin/ps.c:#include ./bin/ps.c: char rflg; /* -r: raw output in style */ 16) ifconfig usage: ifconfig interface [ af [ address [ dest_addr ] ] [ up ] [ down ][ netmask mask ] ] [ metric n ] [ trailers | -trailers ] [ arp | -arp ] 17) touch x chown root:wheel x chown: unknown user id: root:wheel 18) cd /sys/pdpstand ls -l NEW OLD 19) uucico fails to link because the base segment is 64 bytes too large but the Makefile ignores the exit status of 'ld'. cd /usr/src/usr.sbin/uucp make ... cc -o uucico -i cico.o cntrl.o condevs.o ... ld: too big for type 431 *** Exit 2 (ignored) man acucntrl man: no entry for acucntrl in the manual. 20) man symdump man: no entry for symdump in the manual. 21) vmstat -i Device interrupt statistics are not applicable to 2.11BSD Observation. Look at the 'struct nlist nl[]' table in vmstat.c There is no such symbol as _phz anywhere in the kernel source tree. 22) Run the test program: ----x.c--- #include main() { float f = 1.0 , g =0.0; printf("f=%3.0f; g=%3.0f;\n", f, g); printf("f=%.0f; g=%.0f;\n", f, g); printf("f=%3f; g=%3f;\n", f, g); } ------- # cc x.c # ./a.out f= 1; g= ; f=1; g=; f=1.000000; g=0.000000; 23) cd /usr/src/sys/pdpmba ls -l lrwxr-x--x 1 root 11 Apr 8 1998 tags -> ../sys/tags 24) cd /usr/src/sys/bootrom ls -l -r--r--r-- 1 root 1500 Nov 12 1985 siboot.s lrwxr-x--x 1 root 11 Apr 8 1998 tags -> ../sys/tags 25) cd /sys/pdpstand make tape1 mt -f /dev/rmt8 rew mt -f /dev/nrmt8 fsf 7 tar tvf /dev/rmt8 | grep pdpstand Observe .o files, libsa.a and standalone executables (boot, maketape, mkfs, icheck, restor, ...) are present in the source directory: ... rw-r--r-- 0/0 1432 Mar 6 09:11 2026 sys/pdpstand/si.o rw-r--r-- 0/0 4832 Mar 6 09:11 2026 sys/pdpstand/ra.o rw-r--r-- 0/0 52674 Mar 6 09:11 2026 sys/pdpstand/libsa.a ... rwxr-xr-x 0/0 33869 Mar 6 09:11 2026 sys/pdpstand/icheck ... 26) cd /usr/src/local/mtools grep gets mdel.c mdel.c: gets(ans); 27) Configure a kernel with many devices (HT+MSCP+TMSCP+DZ+DHU+ more). After compilation and linking strcompact(1) will run and fail thus: size unix text data bss dec hex 56512 8014 40038 104564 19874 total text: 133824 overlays: 8128,7552,8192,7296,8192,7168,6336,6720,7232,7936,2560 Compacting symbol table symcompact unix symcompact: no memory for symbols *** Exit 71 (ignored) 28) 1) In single user mode OR within /etc/rc before /usr has been mounted use grep and notice "grep: not found" 2) with /usr/ucb/grep present /usr/ucb/grep '*' /usr/src/bin/cat.c Segmentation fault (core dumped) The version in /usr/src/bin/grep.c does NOT fault. 29) as non-root dmesg - "Can't open /usr/adm/msgbuf" 30) Have both /VERSION and /VERSION.old present. sudo /usr/libexec/find/updatedb find VERSION /usr/src/usr.sbin/cron/grot/CONVERSION /VERSION Note /VERSION.old is missing. IF /VERSION.old is not present then /VERSION will be missing when "find VERSION" is done. To determine which file will be is missing from /var/db/find.codes ls / | sort -f | tail -1 31) Observation. For example: running no-op sed scripts on compiler generated assembly code and then running the assembler is dumb and slow. The sed scripts did nothing on a pdp11 and the vax scripts should have been removed when the programs were ported to 2BSD. Almost none of the programs in aux/ would compile, and NONE have ever been installed or used. The whole directory should have been removed a long time ago. 32) One example will be sufficient. /usr/src/bin/cp.c: #ifndef lint char copyright[] = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; #endif not lint #ifndef lint static char sccsid[] = "@(#)cp.c 4.13 (Berkeley) 10/11/85"; #endif not lint instead of #if !defined(lint) && defined(DOSCCS) char copyright[] = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; static char sccsid[] = "@(#)cp.c 4.14 (2.11BSD) 2026/5/5"; #endif hundreds such files exist in the system :( 33) grep sys/file.h /usr/src/man/lseek.2 34) grep flock /usr/include/fcntl.h 35) cd /usr/src/games grep rogue Makefile notice no output If you descend into 'rogue' and 'make' cd rogue make ... cc -O -DUNIX -DUNIX_BSD4_2 -c machdep.c machdep.c:101: _cnt undefined; func. md_slurp machdep.c:101: Illegal structure ref machdep.c:101: warning: illegal combination of pointer and integer, op = *** Exit 1 If that problem is fixed then linking fails: cc -i curses.o hit.o init.o ... -o rogue -lcurses -ltermlib ld:/usr/lib/libcurses.a(refresh.o): text overflow 36) trace bhit bmiss bwrite bhitra bmissra brelse %bhit 874085 99238 42263 71447 70035 1306055 89.80 the 'swapio' entry is missing. man trace man: no entry for trace in the manual Try to get a usage message: trace -v Notice the program goes into a endless loop printing the statistics. Observe the title header is printed every 19 lines and this is not changeable from the commandline. 37) Observation: bk.4 (man bk) says at the top "obsolete" AND "not currently supported under 2.11BSD. Then look in /sys/conf, /sys/pdpif, and /sys/pdpuba and note the serial drivers (dhu, dz, dh, dhv) refer to BKINPUT (in code ifdef'd on NBK) but that macro is never defined. 38) grep NHY /sys/conf/GENERIC NHY 0 # Hyperchannel cd /sys find . -type f -print | xargs grep NHY conf/GENERIC to specify NHY conf/config to generate hy.h netinet/in_proto.c has a table that references nonexistent routines 39) In a kernel build directory with NRAC set to 0 in ra.h, compile the kernel ../machine/conf.c:193: warning: mixed pointer assignment 40) The table sizes (usually coremap) for the GENERIC kernel are sometimes too small. By taking into account the size of the software unibus map (SOFUB_MAP) it is possible to adjust the table sizes (by increasing MAXUSERS) of the GENERIC kernel. 41) cd /usr/ingres/source make chdir equel; make install ... cc -O -c prtout.c prtout.c:409: warning: mixed pointer assignment prtout.c:409: call does not match prototype prtout.c:414: warning: mixed pointer assignment prtout.c:414: call does not match prototype prtout.c:435: puts prototype error *** Exit 1 There are other errors as well. The errors are the result of changes in the stdio library and the C compiler. GCOS support is removed (if anyone needs that then start with the sources from forty years ago). The local stdio routines are removed (system stdio should be used). 42) a) /usr/src/ucb only contains the user front-end sccs.c and no additional sources needed to build the background programs (admin, delta, get, ...). Use "find" to search and no other sccs sources will be found. b) The last member of each entry in SccsProg[] is the pathname of the program program to execute: "sccs get" should cause /usr/local/get to run but instead tries to run /usr/local/name and so on). sccs get sccs SYSERR: cannot execute /usr/local/name No such file or directory 43) grep aflg /usr/src/bin/nm/nm.c char aflg, gflg, nflg, oflg, pflg, uflg, rflg = 1, archive; aflg++; 44) man mkproto See the BUGS section for a list of limitations that reduce mkproto's usability to near zero. 45) cd /sys/netns ls -l -r--r--r-- 1 10 971 Apr 27 1988 idp.h ... (many more) cd /sys/net ls -l -r--r--r-- 1 10 1667 Apr 27 1988 af.c ... cd /usr/src/local/ddd ls -l -rw-r----- 1 10 506 Sep 26 1990 README ... 46) quot cannot open /dev/rrp3 The default device "/dev/rrp3" is not even a modern device/partition format. 47) man strdup man: no entry for strdup in the manual. 48) man setpassent man: no entry for setpassent in the manual 49) Observation. ps.c, w.c, etc do open("/dev/swap", 0), if /dev/swap is incorrect (e.g. wrong disk driver) bogus output or error exit by the program will result 50) Source examination. src/libc/gen/devname.c calls dbm_open but provides no way to release the resources allocated by dbm_open (filedescriptors and 4KB+ of memory). 51) rm /var/run/utmp w Segmentation fault (core dumped) 52) Observation: grep PATH_UTMP pathnames.h cd src/usr.lib/libutil grep PATH_UTMP pathnames.h 53) The function Setenv() in sh.func.c conditionally (on SETENV_IN_LIB) uses its own version of setenv(3) but does not define that macro on systems that have setenv() in libc. sh.c performs Setenv(STRHSTTYPE, GetHostType()). GetHostType() in tc.vers.c does "str2short("pdp11");" which mallocs memory for the string. Setenv() performs str2short(val) which allocates the memory again. The original memory is not freed. tc.os.h had hundreds of lines ifdef/define for obsolete platforms or macros system headers provide. limit cputime 0:0-1 filesize 0 kbytes datasize 0 kbytes stacksize 0 kbytes coredumpsize 0 kbytes memoryuse 0 kbytes limit filesize 100M limit cputime 0:0-1 filesize 0 kbytes datasize 0 kbytes stacksize 0 kbytes coredumpsize 0 kbytes memoryuse 0 kbytes 54) Compile and run the test program: ------x.c------ #include #include #include main() { char buf[9]; int i; i = snprintf(buf, sizeof buf, "%s%s", _PATH_DEV, "swap"); printf("%s %d\n", buf, i); exit(0); } ------------- cc x.c ./a.out Segmentation fault (core dumped) 55) The manpage for strftime(3) states: %b or %h is replaced by the abbreviated month name, where the abbreviation is the first three characters. --------x.c------ #include #include #include #include time_t now; main() { char buf[80], *cp; size_t i; time(&now); i = strftime(buf, sizeof buf, "%h %e %T ", localtime(&now)); printf("%d '%s'\n", i, buf); exit(0); } ----------------- cc x.c ./a.out 17 'June 7 16:33:20 ' Note the extra date string: tail -1 /usr/adm/cron Jun 7 15:45:02 vernon June 7 15:45:02 CRON[14650]: (root) CMD (/usr/libexec/atrun) 56) Notice that the same 'atrun' activity message is being place in both /usr/adm/messages AND /usr/adm/cron grep CRON /usr/adm/messages Jun 6 23:45:02 vernon June 6 23:45:02 CRON[12708]: (root) CMD (/usr/libexec/atrun) grep CRON /usr/adm/cron Jun 6 23:45:02 vernon June 6 23:45:02 CRON[12708]: (root) CMD (/usr/libexec/atrun) 57) Observation. a) #define MAXTTYS 160 /* 128 plus a few extra */ Each entry in allttys[] is 16 bytes so the array is 2560 bytes. A typical system has about 24 tty devices. The waste is large! Also bounds checking and error messages are needed which wastes even more space (both I and D). b) /usr/sys/core hasn't been correct in 40 years. Crashdumps go to /usr/crash/ and use a sequence numbered filename. c) ps evidently was written before getopt() was invented. The inline/hard-wired argv/argc handling is inflexible when making changes to command line options and defaults. 58) In usr.sbin/ntp enable PSTI support and observe that 2026 is shown as 19126 59) Run top after "ps -U" using the updated ps(1): /var/run/psdatabase: Inappropriate ioctl for device Can't read kernel symbols - aborting 60) Change into /usr/src/local/zmodem and do a make install. Note that rz, sz and friends get installed, but crc does not. 61) One example will suffice: grep /dev/swap /usr/src/ucb/w.c if ((swap = open("/dev/swap", 0)) < 0) { 62) Using an Internet machine with a very long domain name, run uucico -r1 -x7 -sfred where fred is the name of the 2.11BSD machine with the buggy uucpd. You will see this debug output: uucico -r1 -x7 -sfred root fred (6/18-08:36-27881) DEBUG (Local Enabled) finds (fred) called getto: call no. fred for sys fred Using TCP to call bsdtcpopn host fred, port 540 login called wanted "login:" login:got: that send "uucp" wanted "assword:" Password:got: that send "uucp1234" root fred (6/18-08:36-27881) SUCCEEDED (call to fred ) TCPIP connection -- ioctl-s disabled imsg looking for SYNC< root fred (6/18-08:36-27881) FAILED (imsg 1) TCP CLOSE called closed fd 5 63) cd /usr/src/usr.bin/patch; grep SCCS *.c (one example will suffice) inp.c: Sprintf(buf+20, "SCCS/%s%s", SCCSPREFIX, filename); inp.c: say2("Can't find %s--attempting to get it from SCCS. 64) grep reciept /usr/src/libexec/acctd/acctd.8 the config file upon startup and reciept of a SIGHUP signal.65) 65) Many Makefiles in the source tree have a 'tags:' target. Only 10 directories have a 'tags' file present and those are outdated to the point of being useless. Two examples will suffice: ls -l /usr/src/usr.sbin/timed/tags /usr/src/usr.bin/f77/tags -r--r--r-- 1 root 2076 Jul 31 1987 /usr/src/usr.sbin/timed/tags -r--r--r-- 1 root 13734 Feb 16 1987 /usr/src/usr.bin/f77/tags 66) Compile the simplified test case (x.f): program junk logical wantev integer x if(wantev .eqv. (0 .eq. x))goto 23002 23002 continue end f77 x.f x.f: MAIN junk: 4: No code table for op: ==(60) type: 0 compiler error. 67) a) cd /usr/src/usr.bin/f77 make mkstr - f77_strings xx equiv.c cc -S -O -w -DTARGET=PDP11 -DFAMILY=DMR -DHERE=PDP11 -DOUTPUT=BINARY -DPOLISH=POSTFIX -DC_OVERLAY xxequiv.c /lib/c2 xxequiv.s | as -V -u -o equiv.o rm xxequiv.c xxequiv.s note that -O is given on the 'cc' line (cc runs /lib/c2) and then /lib/c2 is run again on the assembly (.s) output file. b) The prototype of mktemp() in conflicts with the definition in 'defs' and 'proc.c' 68) a) Observation. Look at the copystr() function, 'case a': is missing. b) x.c: main() { error("a\ab"); } mkstr str x x.c od -cb str 0000000 a a b \0 \n 141 141 142 000 012 0000005 rather than 0000000 a 007 b \0 \n 141 007 142 000 012 0000005 69) port/compile a program using errx() on a system with a strict compiler: error: implicit declaration of function 'errx' is invalid in C99 The solution is to add but that does not exist on 2.11BSD 70) read /sys/h/socket.h - notice PF_ECMA/AF_ECMA/{"emca",CTLTYPE_NODE} (yes - there was a typo in an unsupported protocol family name). PF_CCITT, and many more 71) From the 2.11 system have a program open socket to a remote server, then close the socket while the remote system does not close its end of the connect. After about 25 sockets are in FIN_WAIT_2 the 2.11 system will "wedge" until the server process is terminated (forcing a FIN to finally be sent to the 2.11 system). 72) /usr/games/monop Segmentation fault (core dumped) 73) /usr/games/battlestar note the lack of information displayed. 74) ls -l /usr/games/phantasia /usr/games/lib/phantasia/phantasia lrwxr-xr-x 1 root 23 Jan 2 2026 /usr/games/phantasia -> lib/phantasia/phantasia -rws--x--x 1 root 109685 Jan 2 2026 /usr/games/lib/phantasia/phantasia cd /usr/src/games/phantasia grep phant_run.c Makefile grep test.c Makefile grep signal main.c signal(SIGINT,interrupt,-1); ... (there are many inside the BSD42 blocks) 75) Observation. The meter() function depened on a specific userid and file which do not exist. The call to meter() was commented out but meter() function remained and used ctime() which is large. Use of ctime required use of the -lstubs and ctimed. D space was also wasted by table entries for 'gcos', 'cray', etc. 76) strings /netnix a) note the strings "mget", "mfree" and "m_copy" appear many times. b) note numerous strings such as "unp_connect2" and "unp_disconnect" are present c) note strings "unp_externalize(0%o)" and "unp_internalize(0%o)" are present. 77) Use fgetln() in a program and the linker will give an undefined symbol message. OR "ls /usr/src/lib/libc/stdio" and see that there is fgets.c but no fgetln.c 78) 'lint' used parts of the 'mip' and 'pcc' directories to perform C parsing. When C prototypes became more prevalent lint was removed. the support files should have been removed as well. 79) The F77 runtime calls fatal() when an error (e.g. illegal format in a write statement) occurs. fatal() calls f77_abort() which uses f_exit() to close and initialize the file pointer in the I/O unit array (including STDERR) to NULL. f77_abort() then calls abort() which enters the signal catching routine sigdie(). sigdie() prints messages about the death to stderr which has been closed. The NULL pointer dereference triggers another signel and sigdie() dutifully calls fprintf with a NULL file pointer. cd /usr/src/usr.lib/libI77/test f77 pe.f ./a.out 80) grep getopt /usr/src/bin/rm.c /usr/src/bin/mv.c 81) Compile and run FM413.f from the NIST FCVS (Fortran Compiler Verification System): 1 FORTRAN COMPILER VALIDATION SYSTEM VERSION 1.0 FOR OFFICIAL USE ONLY - COPYRIGHT 1978 SUBSET LEVEL TEST FM413 TEST PASS/FAIL COMPUTED CORRECT ---------------------------------------------- 1 PASS 2 PASS 3 PASS 4 PASS 5 PASS 6 PASS 7 PASS 8 PASS 9 PASS 10 PASS 11 PASS 12 PASS 13 PASS 14 PASS 15 PASS 16 PASS 17 PASS 18 PASS 19 FAIL 1 30 20 FAIL 5 30 21 FAIL 1 30 22 FAIL 1 30 23 FAIL 3 30 24 FAIL 1 30 25 FAIL 1 30 26 FAIL 1 30 27 FAIL 1 30 28 FAIL 1 30 29 FAIL 5 30 30 PASS 31 PASS uio: [-1] end of file logical unit 9, named 'fort.9' lately: reading direct unformatted external I/O IOT trap (core dumped) 82) cd /usr/src/share/adb/PORT ls 83) cfree() is in libc/gen/calloc.c, takes 3 arguments and passes the first arg to free(). Some uses (in lex(1)) used 3 args but most just used 1. All were changed to free() and 1 arg. 84) The setup documentation was not given a lot of attention when it was written. Developers writing/debugging/running the setup process almost daily do not make the best documentation writers. Fix: 1) Implement the 4.4BSD -T option, ls -lT produces full time info in "MMM DD HH:MM:SS YYYY" format: ls -lT tstoggle.s -r--r--r-- 1 sms 614 Nov 9 22:28:05 1993 tstoggle.s 2) Replace touch program with the 4.4BSD touch program. touch -t 202401021234 foo ls -lT foo -rw-r--r-- 1 sms 0 Jan 2 12:34:00 2024 foo 3) Add the vm.nswap mib to sysctl 4) Use the __STDC__ blocks of code and remove the #ifdef/#endif lines 5) Update the Makefiles clean: target 6) Modify programs to use fgets() instead of gets(). This usually requires adding code to remove the trailing \n. 7) Remove README.NIS BLURB vfprintf.c. printf.ck README.IRIX 8) pstat.8 is revised with correct information. pstat.c updated to not use XPAGI (which is also removed from /sys/h/text.h) 9) install the 4.4BSD mkdir program into 2.11BSD and remove the old source and manpage. 10) remove kaiser.c and types.c Fix gets() use in deliv1.c and update Makefile to build/install 'deliv'. sources to 'whatabout': "what{.,1,2,3,4}.c are removed. make targets whatabout: and refpart: are removed. 11) To fix the problems: (1) descend() calls itself recursively and does a chdir() into the directory to be scanned. Upon return find uses fchdir+chdir to restore the current path before doing the next readdir(). If the chdir() fails due to a permission error find should ignore the directory and since the current directory has not changed continue the readdir() loop. Fix is to have descend() return(1) instead of return(0) if chdir() fails. If the chdir() succeeds an opendir(".") is done. If this fails (no read permission) then the fchdir+chdir after return must be done. However immediately before the fchdir(Home) find nulls the end of the pathname with "*endofname = '\0'. This converts Pathname from "/" to "" and the chdir(Pathname) does nothing which leaves find in the wrong directory to continue the readdir() loop. The fix is change chdir(Pathname) to chdir(Pathname[0] ? Pathname : "/") Even after all that an ominous looking "can not open < .. >" message would be printed if opendir(".") failed due to an access (no read permission) error. The fix was to use 'access(".", R_OK);' before the opendir(). If access is denied then quietly back up and return - avoiding the noisy error. opendir() can fail for other reasons so the message remains present. (2) Change getuid() and getgid() to xgetuid() and xgetgid(). Dumb to use C library names as local functions. (3) AMES was always defined. Remove the #define AMES and the #ifdef/#endif use. SUID_PWD only declares popen() - no code so this entire block is removed. 2.11BSD has "%lu" so there's no need to #ifdef pdp11 the use of "%lu" with printf() 12) Create /root and set mode to 700, move "." files from / to /root, use vipw to change root's directory in the passwd file. NOTE: there must be a minimal /.profile (PATH=...) for use by sh in single user mode. A minimal /.profile is created in the instructions below. 13) Another large contribution from Anders Magnusson Thank you very much! From the author of the changes: ctype: Make ctype Ansi-C-compliant; (C99 7.4) - All of the macros shall be possible to call as functions as well. - Add isblank() as function. - Change toupper()/tolower() to only be functions (side effects). float: (C99 7.7) - Add /usr/include/machine/float.h - Symlink /usr/include/float.h -> /usr/include/machine/float.h inttypes: (C99 7.8) - Add /usr/include/inttypes.h - Add functions imaxabs()/imaxdiv()/strtoimax()/strtoumax() iso646: (C99 7.9) - Add /usr/include/iso646.h locale: (C99 7.11) - Add /usr/include/locale.h - Add setlocale()/localeconv(). Trivial functions, only C locale is supported. stdint: (C99 7.18) - Add missing type declarations and macro definitions. C compiler fixes: - Understand "restrict" keyword (but ignore it). (C99 6.7.3) - Remove check for (unsupported) /\ (MAX) and \/ (MIN). - Understand variable declarations anywhere in a block, not only at the beginning. (C99 6.8.2) Manpage updates for everything. 14) The first problem is shar does a chdir() into a directory to open/read the files within but does not do a chdir() back to the original directory. If the next command line argument processed is a relative path it will be interpreted from the wrong current directory. Fix is to open(.) on startup and use fchdir() after processing each command line argument. The second problem is the generated shell script. shar generates "mkdir ./usr/src/bin/mkdir" followed by "cd ./usr/src/bin/mkdir" and then the commands to extract the files (and subdirectories if any). At the end of processing ./usr/src/bin/mkdir a "cd .." is done. That only moves up one level leaving 'sh' in ./usr/src/bin which causes the extraction of the next file/directory (./usr/src/bin/ps in this case) to fail. The fix is for shar to add "export STARTDIR; STARTDIR=`pwd`" at the top of the script and emit "cd $STARTDIR" after processing a directory argument. Also a little cleanup in shar.c was done. 15) Each .h file is relocated to the program which includes it. /usr/include/OLD is removed. 16) All kernel support for trailers (including ifdef'd/commented out) was removed in patches #498 and 499. Remove trailers from ifconfig and ifconfig.8 now. 17) Add support for ":" as the user:group separator. The old style "user.group" is retained for compatibility (numerous Makefiles use the "." form). NOTE: allowing '.' to be used this way precludes having '.' in a username. 18) Remove the /sys/pdpstand NEW and OLD directories. 19) Fix the Makefile to move a small .o file to an overlay. Add the format and install of acucntrl.0 and remove unsupported dmf device. 20) Add symdump.1 to src/man/man1 21) Remove "_intrcnt" along with the other non-pdp11 entries from the list of kernel symbols to look up. Remove vax ifdef'd blocks of source. Change /sys/pdp/symbols.raw to comment out _phz (as was done for other 4BSD kernel symbols). The file symbols.sort will be regenerated on the next kernel build. 22) src/lib/libc/stdio/pfcom.c calls fcvt() which returned an empty string if ndigit is 0 and the rounded result is (1 > res > -1). Fix is to set "0" instead of "" if number of digits converted is 0. 23) 4.3BSD separated device driver sources by bus (vaxuba or vaxmba). 2.11BSD created the pdpmba directory but then placed all the drivers in 'pdpuba'. The fix is to remove the superfluous 'pdpmba' directory and symlinks. 24) Remove src/sys/bootrom 25) In the targets "tmscptape:" and "tape1:" after the line ./maketape /dev/nr${TAPE} maketape.data add make clean NOTE: If "make install" is done AFTER "make tmscptape" (or "make distribution") the standalone programs will be recompiled. To avoid the recompilation do the "make install" before making the distribution tape. 26) replace gets() with fgets() and \n clearing logic. Use system header files rather than local declarations for strcpy(), etc. 27) symcompact attemtps to hold both the symbol table AND symbol strings in memory at the same time. Eventually the combined memory required exceeds 56KB and malloc() fails when allocating memory for the string table. strcompact is modified to use the virtual address facility, (libvmf), which ld(1) and cpp(1) use, for the symbol table. This makes available much more memory for the string table. It is believed that strcompact(1) can now handle any file ld(1) can create. 28) /usr/src/bin/grep.c is restored to the system (it's present in the 500.new shar file). grep in /usr/src/ucb and /usr/ucb/ is removed and src/bin/Makefile and src/ucb/Makefile are updated. 29) /usr/adm/msgbuf has not existed in a very long time. dmesg should not attempt to create that file. syslogd has taken over system error log. dmesg is, however, useful for quickly displaying the last few kernel diagnostic messages. dmesg.c is updated to not look for arguments. 30) In 'updatedb.csh' after the $filelist (sorted file list) has been created but before running 'bigram' and 'code': set fake=`tail -1 $filelist`.xxx echo $fake >> $filelist 31) fix the two files with invalid string initialization (compiler changes) in sendmail.MX. Then in both sendmail and sendmail.mx remove aux/ and cruft from md/ and include/ 32) change "#ifndef lint" to "#if !defined(lint) && defined(DOSCCS)" 33) change to or . lseek.2 is converted to the new 4.4BSD nroff macros. 34) Add prototypes for open, fcntl, flock, creat. 35) machdep.c was modified to use fpurge(3) (added in patch #499). An overlay layout was created and Makefile updated to install the executable in the proper place and create an empty scores file. 36) The 'trace' program is replaced by a new program 'tracebuf' (installed in /usr/sbin). tracebuf has options to specify interval between reports, the number of reports and how often to print the title header. The old files /usr/src/local/trace.c and /usr/local/trace are removed. 37) Remove bk.4 and bk.0 then remove the "ifdef NETLDISC" blocks from dhu,dhv,dz,dh.c and NETLDISC from ioctl.h 38) Update sys/conf/config, sys/conf/GENERIC and netinet/in_proto.c to remove Hyperchannel (NHY) 39) Change "#define rasize nodev" to "#define rasize NULL" 40) Change "_sofub_size" to be a initialized data value rather than a runtime set value (this affects machdep.c and machdep2.c). Then add "sofub_size" to the list of symbols used by 'checksys.c' in computing the total kernel size. The MAXUSERS value for the GENERIC kernel is raised from 4 to 6 with room for a slightly higher values if needed. 41) 17 files needed changes (don't use 'const' as a variable name, use system stdio, don't use "FILE *" as 'int' and so on). 42) sccs files are removed from the system. 43) Remove -a support from nm 44) Remove mkproto(8) from the system. 45) "chown root" files 46) Change default to more common device: /dev/rxp0a and /dev/rxp0h 47) Create src/man/man3/strdup.3 48) src/man3/Makefile link man/cat3/getpwent.0 to man/cat3/setpassent.0 49) A new mib was added to the sysctl interface. VM_SWAPDEV is added to kern_sysctl.c (and vmstat extended to display 'vm.swapdev'). 2.11BSD sets the kernel 'swapdev' variable to the boot device (unless -R is used with boot). If the booted device is different than the device /dev/swap points to 'ps' and other programs will not function correctly. Usage: mib[0] = CTL_VM; mib[1] = VM_SWAPDEV; len = sizeof (int); sysctl(mib, 2, &swapdev, &len, NULL, 0); sysctl vm vm.loadavg: 0.82 0.56 0.32 vm.nswap: nswap = 8359 vm.swapdev: swapdev = 10,1 A new function swapdevname(3) is added to libc. swapdevname will first use sysctl(3) and devname(3) to generate the swap device string. If sysctl support is missing or swapdev can not be found in the database (dev_mkdb(8)) then the traditional "/dev/swap" will be returned. 50) Add devname_close() to libc and to the manpage. 51) NULL pointer dereference. w(1) does not check if the open failed. 52) remove pathnames.h and replace references to "pathnames.h" with , , etc in the C files. 53) Edit Setenv() to leave only the code which calls system's setenv() Change GetHostType(), return "pdp11" in place of str2short("pdp11"); There are almost certainly other memory leaks in tcsh but this small one was too easy a fix to pass up. tcsh will exhaust memory after a long session. At that time it's necessary to exit and restart tcsh. Edit tc.os.h to include three system header files, define a small number of macros and a typedef. tc.os.h goes from 406 to 58 lines. Fix typedef for RLIM_TYPE (it was incorrectly set to 'int'): limit cputime unlimited filesize unlimited datasize unlimited stacksize unlimited coredumpsize unlimited memoryuse unlimited limit filesize 100M limit cputime unlimited filesize 102400 kbytes datasize unlimited stacksize unlimited coredumpsize unlimited memoryuse unlimited Not all unnecessary ifdefs were removed. Code is gradually becoming readable. Need to leave something for a rainy day :-) 54) snprintf should place "sizeof (buf) - 1" bytes in the output, then keep incrementing output count w/o placing data in the buffer. The output of the test program should have been: /dev/swa 9 "/dev/" + "swap" = 8 bytes but only 8 "/dev/" + "swa" fit. the terminating null is NOT included in the return value of snprintf. Fix from Anders Magnusson for stdio/wbuf.c I changed a part of the output path to minimize the size of printf() but missed to take into account the use of snprintf(). 55) strftime.c was testing for '%h' not '%h' AND '%b'. Simple if statement change to treat 'h' and 'b' the same and both now return 3 month name. If syslogd(8) did not see 16 characters ("June 7 ..." is 17) an extra date/time string was added. cc x.c ./a.out 16 'Jun 7 16:44:55 ' and after recompiling/restarting cron(8): Jun 7 17:00:03 vernon CRON[15005]: (root) CMD (/usr/libexec/atrun) Any program that uses syslog(3) needs to be recompile to pick up the change in strftime(3). That will happen, of course, when the system is recompiled. strftime(3) is now declared in time.h 56) cron(8) has its own logfile specified in /etc/syslog.conf therefore the cron facility needs to be excluded from the /usr/adm/messages file. The prototype syslog.conf file in /usr/src/etc/syslog.conf IS patched by this update. Because /etc/syslog.conf is a locally configured file the installed file is not changed. To manually change /etc/syslog.conf add ",cron" after "lpr" in the /usr/adm/messages line: For example: *.err;auth.notice;*.info;kern.debug;local7,mail,daemon,lpr.none /usr/adm/messages becomes *.err;auth.notice;*.info;kern.debug;local7,mail,daemon,lpr,cron.none /usr/adm/messages Then restart syslogd (or wait for the reboot after building the kernel below). 57) Make use of (more) modern routines. a) dev_mkdb(8) builds a DBM database of /dev and devname(3) uses the database to map a dev_t to a device name. ps.c was modified to use devname(u.u_ttyd, S_IFCHR) instead of a static array. Even after the DBM database memory the D space savings were 1KB+! b) The -k option was enhanced to use an argument and not an additional filename after the options. There is not a default for the memory image file. c) getopt(3) replaces the inlined/local argument handling: ps [ -acgp:k:lnrt:uwxU [ swap [ system ] ] The '-p' option is new and replaces relying on the pid (#) being the last argument. Thus "ps 1234" is replaced by "ps -p 1234". The source code reductions were enough to "pay" for getopt() and devname(). The text space growth was almost nothing. 58) In the words of Folkert van Heusden (folkert@vanheusden.com): "Noticed a y2k bug in ntp. It only appears when you enable PTSI support (a refclock). My emulator emulates the PTSI (via PPS on the host) that's why I noticed it. "19%d",rtm->tm_year changed in places to "%d",1900+rtm-_tm_year in read_psti.c 59) The problem was caused by top having a local copy of the structure ps(1) used in creating /var/db/psdatabase. When ps(1) changed top(1) ceased working. Upon investigation almost NONE of the information from psdatabase was being used! A lot of memory was being allocated for tty names, kernel wait channel info and un-used user/process data. psdb.c and psdb.h are removed from the source tree and top.c updated to retrieve the necessary kernel variables and remove the ttyname processing (which was not used or displayed). 60) zmodem Makefile is patched to install both the crc executable and its manpage. 61) Update ps(1), w(1), fstat(8), identd(8), top(1) to use the new libc function swapdevname(3). 62) Fix provided by Warren Toomey (wkt@tuhs.org). Replace a strcpy() with strncpy() in uucpd.c 63) Clean up the patch source directory to remove SCCS (and RCS). The manpage is also updated to remove reference to SCCS. 64) Fix the misspelled word. Also correct capitalization in a couple places. The updated manpage will be installed during the recompile of the system. 65) Rather than regenerate tags files the outdated ones are removed. IF a developer wants to use "vi -t" then a "make tags" can be done first. The 10 files are added to the removal script. 66) The bug was first reported Nov 4, 1985 (/usr/src/usr.bin/f77/BUG?). At that time the bug was thought to be in c1 (pass2 of C compiler). In the words of Anders Magnusson (thanks for figuring out where the problem actually was). The double comparison (if(wantev .eqv. (0 .eq. x))) creates a logical result. The intermediate file gets: NAME EXTERN LONG v.1 LCON LONG 0 0 NAME EXTERN LONG v.2 EQUAL 0 EQUAL 0 CBRANCH lbl=14 cond=0 line=4 Doing something similar in C gives: NAME AUTO LONG -12 CON INT 0 ITOL LONG NAME AUTO LONG -16 EQUAL 0 ITOL LONG EQUAL 0 CBRANCH lbl=4 cond=1 line=6 The result of a long long comparison is an 'int' but f77 does not print out a cast for the first EQUAL to LONG and a table entry for (int) == (long) does not exist in c1. The problem was that 'logical' variables were defined as being TYLONG (long) rather than TYSHORT (int). Changing 'int tylogical' to TYSHORT resolved the issue but did need small changes to libI77 (see #81). 67) Modify the Makefile to use the same logic as pascal/pi. The pi Makefile uses tmp/ as the prefix with mkstr and does not use -S and run the "/lib/c2 | as" pipeline: rm -f tmp/equiv.c mkstr - f77_strings tmp/ equiv.c cc -O -I. -w -DTARGET=PDP11 -DFAMILY=DMR -DHERE=PDP11 -DOUTPUT=BINARY -DPOLISH=POSTFIX -DC_OVERLAY -c tmp/equiv.c rm -f tmp/equiv.c The f77 sources were cleaned up. Unused options (-DPOLISH above for example) were removed. It was amazing how much cruft could be removed and the executables were identical! Non PDP11 platforms (INTERDATA, GCOS, etc) removed. The compiler is now a PDP-11 compiler ONLY, there is no need for TARGET, HERE or FAMILY definitions or ifdefs in any of the files. misc.c had included some time ago but the addition of the mktemp prototype in stdlib.h introduced the conflict. Change all references to mktemp() in the f77 sources to mktmp() 68) add 'a' and 'v' and reorganize copystr() to use a simple 'if' instead of a switch statement with only 1 'case'. Also add a bounds check to avoid overflowing the string buffer on the stack. 69) port err.h from 4.4BSD 70) Remove PF_NBS (7) thru PF_APPLETALK (17) from socket.h The only application affected is 'sysctl' (for the NET mib). 71) Many systems have implemented a timeout for the FIN_WAIT_2 state. Problem has been widely discussed. A simple search for fin_wait_2 will find many discussions of the problem and workarounds. The default timeout is set to 30 seconds. The value is manipulated via "sysctl net.inet.ip.tcp_fw2timeout" 72) The make file places shared strings (created using xstr) into the text segment (I space) and then creates a split I/D executable. Running an ed script to change .data to .text is stupid/wrong. The Makefile was updated and the ed script removed. 73) Macro evaluation done by cpp has changed immensely since battlestar was written. In externs.h the macro PATH(x) was not being evaluated correctly. The two uses of the macro were changed to define the correct pathnames. 74) Makefile was updated to build/install phantasia as setuid daemon. USG3 and USG5 and BSD41 removed to reduce clutter. Unused files removed. The support directory is recursively chown'd to daemon. Also the modes of the files in /usr/games/lib/phantasia were wrong BUT the 'setfiles' program used during installation will not touch existing files. The solution is to remove both the symlink AND the lib/phantasia directory (this is done by the 500.rm script). The directory and contents will be correctly installed during the rebuild of the system. 75) files in efl source directory were cleaned up by removing support for non-unix systems. Hundreds of bytes of D space were saved and saving 2.5KB of I space removed the need to overlay the program. 76) a) the macros MGET() and MFREE() include panic("mget") and panic("free"). Each use of MGET uses 5 bytes of D space and MFREE uses 6 bytes. b) panic strings should be unique and short to idenfity a location in the sources not full descriptions of the problem. c) there were two debug/diagnostic printf() statements left behind in uipc_usrreq.c (a) was taken care of by use of char constant instead of repeated quoted strings. For example: char mgetStr[] = "mget"; and have MGET use panic(mgetStr) instead of panic("mget") (b) shorten panic() strings to be unique numbered strings in uipc_usrreq.c (c) remove the two printf()s Total D space savings OVER 300 were obtained (and 1 click of text space on my system). Enough for another mbuf ;) OR table space from a 2nd device driver. 77) The author of the ANSI stdio portion of #499 sent the missing file. 78) the directories 'mip' and 'pcc' are removed in the 500.rm script. 79) There are two bugs in libI77/f77_abort.c - the first is a logic flaw that causes the coredump logic to be executed for normal (non-exception/signal based) errors. A program is expected to coredump for a SIGILL (illegal instruction) but NOT for a bad format string in a write statement. a) f77_abort is called as f77_abort(nargs, err_val, act_core) The statement: core_dump = (nargs != 2) || act_core; IS WRONG. All the calls, except one, to f77_abort() are as f77_abort(0) or f77(1, errorcode). These are to print a diagnostic message and exit without a coredump. Only one call libF77/main.c uses the three argument form: f77_abort( 2, s, act->core ); The correct logic is "core_dump = (nargs == 2) && act_core);" b) IF a coredump is requested the STDERR I/O unit should NOT be closed until after abort() has issued the error messages. move, in f77_abort.c the f_exit() AFTER the abort() statement. There is no need for f77_abort() to call _cleanup() because exit() will do it. 80) Not using getopt(3) required rm and mv to reserve the special null arg "-" to signal the end of options, allowing files/directories beginning with '-' to be removed. getopt returns EOF with the arg "-" but leaves optarg pointing at "-", rm and mv need to do nothing special to handle files starting with -. The manpage for rm(1) was updated to remove references to rmdir since rmdir(1) has its own manpage. 81) The biggest problem was the use of "a" as the mode in calls to fopen() and freopen(). Ever since 4BSD implemented O_APPEND in the kernel (and 2.11BSD inherited the kernel behaviour from 4.3BSD) ALL write operations (not just the first after the open) go to the end of the file. That behaviour breaks Fortran ACCESS=DIRECT file handling where WRITE functions specify a record number (REC=) but the write() were being done at the end of the file. The most important part of the fix was to use "append" mode only for SEQUENTIAL files and not for DIRECT access. There were a couple other problems in libI77 the most significant was the wasting 2.2KB of D space in the i/o units[] table. Reading and writing LOGICAL variables was changed to match the behaviour of the f77 compiler (see #66 above). 82) Remove the PORT directory and N (Xerox NS) directories. ADD two new scripts for displaying kernel disk structure (dkdevice) and partition table of the kernel resident disklabel. 83) cfree() was removed from src/lib/libc/calloc.c and all references to cfree() in the system were changed to free() 84) Thanks to Terri Kennedy (terri@glaver.org) for volunterring to rewrite/update the 2.11BSD setup documentation. Many more thanks for learning eqn/tbl/troff and not converting the documentation to DECdocument's SDML :) Save this file to /tmp/500 This is a large patch (over 1300 files are patched) and 'vi' on a 2.11BSD system can not handle this file. The shar file contains a removal script, a shar file of new files being added to the system and a patch file to modify existing files: 500.rm 500.new 500.patch Some files appear in both 500.rm and 500.new because the program is being relocated or completely replaced. Other files in 500.rm are being removed as obsolete ('makedb', 'pathalias', ...), do not work ('decompr16'), are not built/installed/obsolete ('notes') or pointless (lisp.0 manpage but no lisp program). NOTE: If there are programs/directories you want to retain on the local system review and update 500.rm before running the script. # Optional: To output the text up to (but not including the cut here line) for # easy viewing or printing: cd /tmp sed -e '/^---*cut here---.*/,$d' < 500 > 500.txt Extract the shar file: cd /tmp sed -e '1,/^---*cut here---.*/d' < 500 > 500.shar Then: sh 500.shar cd / sh /tmp/500.rm sh /tmp/500.new ln -s /usr/include/machine/float.h /usr/include/float.h patch -p0 < /tmp/500.patch check for any failed patches: find . -name '*#' -print and resolve the issue(s) before continuing. over the years a few files acquired weird owner names and need to be changed chown root /sys/netns/* chown root /sys/net/* chown root /usr/src/local/ddd/* chown root /usr/src/ucb/rlogin/rlogin.c the updated 'grep' requires tolower() which is a newly added to libc. update libc with one file: cd /usr/src/lib/libc/gen make ctype_.o ar rv /lib/libc.a ctype_.o ranlib /lib/libc.a rm ctype_.o profiled/ctype_.o rebuild entire system from sources. libc can not be recompiled until the updated compiler is in place. this is because some of the new C99 sources use the "restrict" keyword. cd /usr/src/lib/ccom make install make clean some makefiles use 'grep' so install 'grep' into /bin before recompiling the world. cd /usr/src/bin make grep install -s -m 755 -o root -g staff grep /bin NOW the world can be recompiled from sources cd /usr/src make build make installsrc make clean create root's new home directory: cd / mkdir -m 700 root the update to root's entry in the passwd file is not automated. Use 'vipw' to manually make the change. Change field 6 (the home directory) of the line (you may also change "The Man" to "System Administrator" or name of local choice at the same time): vipw change (leave the 2nd field, the password, untouched): root:xxxxxxxxxxxxx:0:1:The Man:/:/bin/sh to root:xxxxxxxxxxxxx:0:1:The Man:/root:/bin/sh or (for example): root:xxxxxxxxxxxxx:0:1:System Administrator:/root:/bin/sh relocate the dotfiles from / to /root. to see the list of files that would be moved: ls -A / | egrep -e '^\.' you can move the files manually or use the following: mv `ls -A / | egrep -e '^\.'` /root a minimal /.profile MUST exist for use by 'sh' in single user mode else 'sh' can not find some programs ('fsck' for example). When in multiuser mode root's directory is /root with the full .profile Install /.profile: install -c -m 640 -o root -g wheel /usr/src/etc/root/dot.minimal /.profile changes to 'ps' altered the psdatabase structure. therefore the database in /var/run needs to be rebuilt. this is done upon reboot (in /etc/rc) but 'ps' may be used before then: ps -U a kernel recompile is required to pick up the changes to the kernel and networking. cd /sys/YOURKERNEL make install -c -m 644 -o root -g wheel unix netnix / make clean Shutdown and reboot the system cleanup: rm -f /lib/oc? /bin/tcsh.old /etc/init.old if you maintain a GENERIC kernel recompile and install it. some admins use /genunix other admins use a different location THIS IS OPTIONAL: cd /sys/GENERIC make install -c -m 644 -o root -g wheel unix /genunix make clean patching will have created MANY (over 1300) files with tilde (~) appended. clean up the system by removing *~ files. cd / find . -name '*~' -print | xargs rm cd / echo -n "Patch 500 applied " >> PATCH-LOG date >> PATCH-LOG echo -n "System now at 2.11BSD 35th Anniversary Edition (PL500) " >> PATCH-LOG date >> PATCH-LOG Congratulations! Your system is now running "2.11BSD 35th Anniversary Edition" this and previous updates to 2.11BSD are available at the following locations: ftp://ftp.dfupdate.se/pub/pdp11/2.11BSD https://www.tuhs.org/Archive/Distributions/UCB/2.11BSD/Patches/ ftp://ftp.2bsd.com/2.11BSD http://www.2bsd.com/2.11BSD/