Subject: rdist(1) runs out of memory on complex hierarchies (#378) Index: ucb/rdist/Makefile,main.c 2.11BSD Description: rdist runs out of memory when processing a filesystem with many hardlinked files (such as formatted manpage directories). Repeat-By: Use rdist to update/transfer a filesystem with about twice the complexity of /usr. Fix: There will always be a filesystem large enough that rdist on a PDP-11 can not handle it. The fix below raises the limit enough that a filesystem of approximately twice the complexity of /usr can be successfully dealt with. The changes are very small and apply techniques used in several other programs (sendmail and c-kermit for example). Using the 'stubs' library (libstubs.a) and 'ctimed' daemon makes about 3kb of Data space available. Then using smaller buffers allocated on the stack for stderr, stdout and stdin saves about 2.5kb. Total savings are about 5.5kb. No noticeable increase in runtime was observed as a result of using 'ctimed'. While the rdist process used about 46 minutes of cpu time the ancilliary 'ctimed' process only used about 40 seconds. To apply the update cut where indicated and save to a file (/tmp/378). Then: patch -p0 < /tmp/378 cd /usr/src/ucb/rdist make make install make clean 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------------------------- *** /usr/src/ucb/rdist/Makefile.old Thu May 11 22:56:01 1995 --- /usr/src/ucb/rdist/Makefile Thu Jul 3 08:53:37 1997 *************** *** 3,9 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.1.3 (2.11BSD GTE) 1995/05/11 # DESTDIR= SEPFLAG= -i --- 3,9 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.1.4 (2.11BSD GTE) 1997/7/3 # DESTDIR= SEPFLAG= -i *************** *** 21,27 **** rm -f x.c rdist: ${OBJS} strings.o ! ${CC} ${SEPFLAG} -o rdist ${OBJS} strings.o ${OBJS}: defs.h --- 21,27 ---- rm -f x.c rdist: ${OBJS} strings.o ! ${CC} ${SEPFLAG} -o rdist ${OBJS} strings.o -lstubs ${OBJS}: defs.h *** /usr/src/ucb/rdist/main.c.old Wed May 10 08:19:13 1995 --- /usr/src/ucb/rdist/main.c Thu Jul 3 09:00:31 1997 *************** *** 9,15 **** "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)main.c 5.1.1 (2.11BSD) 1995/05/09"; #endif #include --- 9,15 ---- "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)main.c 5.1.2 (2.11BSD) 1997/07/03"; #endif #include *************** *** 52,57 **** --- 52,62 ---- register char *arg; int cmdargs = 0; char *dhosts[NHOSTS], **hp = dhosts; + char ebuf[128], obuf[256], ibuf[256]; + + setbuffer(stdin, ibuf, sizeof ibuf); + setbuffer(stdout, obuf, sizeof obuf); + setbuffer(stderr, ebuf, sizeof ebuf); pw = getpwuid(userid = getuid()); if (pw == NULL) { *** /VERSION.old Sun Jun 29 16:10:35 1997 --- /VERSION Sun Jul 6 20:31:24 1997 *************** *** 1,5 **** ! Current Patch Level: 377 ! Date: June 29, 1997 2.11 BSD ============ --- 1,5 ---- ! Current Patch Level: 378 ! Date: July 6, 1997 2.11 BSD ============