[net.bugs.4bsd] restore R dumps core

steve@tellab3.UUCP (Steve Harpster) (10/24/84)

Under 4.2BSD, restore R causes a segmentation fault then proceeds to
dump core. Using ADB I found out it dies in bcopy() which is called
from readtape(). Does anyone have a fix for this? I really haven't
got the time or patience to wade through restore. Thanks.
-- 
...ihnp4!tellab1!steve
Steve Harpster
Tellabs, Inc.

crp@ccivax.UUCP (Chuck Privitera) (10/30/84)

> Under 4.2BSD, restore R causes a segmentation fault then proceeds to
> dump core. Using ADB I found out it dies in bcopy() which is called
> from readtape(). Does anyone have a fix for this? I really haven't
> got the time or patience to wade through restore. Thanks.
> -- 
> ...ihnp4!tellab1!steve
> Steve Harpster
> Tellabs, Inc.

I ran in to the very same problem. Here's the fix, line
numbers may be off:

rcsdiff -c5 -r1.1 -r1.2 main.c
*** /tmp/,RCSt1001216	Tue Oct 30 08:42:11 1984
--- /tmp/,RCSt2001216	Tue Oct 30 08:42:13 1984
***************
*** 188,197
  		done(0);
  	/*
  	 * Resume an incremental file system restoration.
  	 */
  	case 'R':
  		initsymtable(symtbl);
  		skipmaps();
  		skipdirs();
  		createleaves(symtbl);
  		createlinks();

--- 188,198 -----
  		done(0);
  	/*
  	 * Resume an incremental file system restoration.
  	 */
  	case 'R':
+ 		setup1();
  		initsymtable(symtbl);
  		skipmaps();
  		skipdirs();
  		createleaves(symtbl);
  		createlinks();

rcsdiff -c5 -r1.1 -r1.2 tape.c
*** /tmp/,RCSt1001224	Tue Oct 30 08:42:52 1984
--- /tmp/,RCSt2001224	Tue Oct 30 08:42:57 1984
***************
*** 160,169
  	curfile.action = USING;
  	getfile(xtrmap, xtrmapskip);
  }
  
  /*
   * Prompt user to load a new dump volume.
   * "Nextvol" is the next suggested volume to use.
   * This suggested volume is enforced when doing full
   * or incremental restores, but can be overrridden by
   * the user when only extracting a subset of the files.

--- 160,188 -----
  	curfile.action = USING;
  	getfile(xtrmap, xtrmapskip);
  }
  
  /*
+  * Initialize fssize variable for 'R' command to work.
+  */
+ 
+ setup1()
+ {
+ 	struct stat stbuf;
+ 
+ 	if (stat(".", &stbuf) < 0) {
+ 		perror("cannot stat .");
+ 		done(1);
+ 	}
+ 	fssize = stbuf.st_blksize;
+ 	if (fssize <= 0 || ((fssize - 1) & fssize) != 0) {
+ 		fprintf(stderr, "bad block size %d\n", fssize);
+ 		done(1);
+ 	}
+ }
+ 
+ /*
   * Prompt user to load a new dump volume.
   * "Nextvol" is the next suggested volume to use.
   * This suggested volume is enforced when doing full
   * or incremental restores, but can be overrridden by
   * the user when only extracting a subset of the files.