[net.bugs.4bsd] serious bug in dump

dlw@ucbopal.CC.Berkeley.ARPA (03/03/84)

Index:	/usr/src/etc/dump	4.2	Fix

Description:
	There is a serious bug in 4.2 bsd dump/restore. It can
	prevent restore from working even though the tape is "good".
	I posted a full description of this bug under
		Index:	/usr/src/etc/restore
	even though the real bug is in ``dump''. This is because
	it is necessary to fix ``restore'' in order to be able to
	use existing dump tapes.

	The problem is that restore needs the full inode bitmap
	for the filesystem. Dump, as distributed, truncates the
	map to the smallest size possible (the highest inode of
	interest). This causes restore to FAIL in some cases.

Repeat-by:
	newfs /dev/rra0h ra81
	dump 0 /dev/rra0h
	...(add stuff to the filesystem)...
	dump 3 /dev/rra0h

	Now try to restore it.

Fix:
	Below is a diff of dumptraverse.c that will fix the bug.
	The line numbers may not match yours. The routine is
	``bitmap()''.
------
diff  dumptraverse.c.old  dumptraverse.c
------
210,218c211
< 	n = -1;
< 	for (i = 0; i < msiz; i++)
< 		if(map[i])
< 			n = i;
< 	if (n < 0)
< 		return;
< 	n++;
<
< 	spcl.c_count = howmany(n * sizeof(map[0]), TP_BSIZE);
---
> 	spcl.c_count = howmany(msiz * sizeof(map[0]), TP_BSIZE);