From dwmalone@maths.tcd.ie  Tue Feb 10 10:29:10 1998
Received: from salmon.maths.tcd.ie (mmdf@salmon.maths.tcd.ie [134.226.81.11])
          by hub.freebsd.org (8.8.8/8.8.8) with SMTP id KAA15538
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 10 Feb 1998 10:29:05 -0800 (PST)
          (envelope-from dwmalone@maths.tcd.ie)
Received: from synge.maths.tcd.ie by salmon.maths.tcd.ie with SMTP
          id <aa22439@salmon.maths.tcd.ie>; 10 Feb 98 18:28:54 +0000 (GMT)
Message-Id: <9802101828.aa06956@synge.maths.tcd.ie>
Date: Tue, 10 Feb 98 18:28:53 +0000 (GMT)
From: dwmalone@maths.tcd.ie
Sender: dwmalone@maths.tcd.ie
Reply-To: dwmalone@maths.tcd.ie
To: FreeBSD-gnats-submit@freebsd.org
Subject: restore coredumps on filesystems with small blocksizes
X-Send-Pr-Version: 3.2

>Number:         5704
>Category:       bin
>Synopsis:       restore coredumps on filesystems with small blocksizes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 10 10:30:00 PST 1998
>Closed-Date:    Mon Mar 23 15:15:04 PST 1998
>Last-Modified:  Mon Mar 23 15:18:23 PST 1998
>Originator:     David Malone
>Release:        FreeBSD 2.2.5-STABLE i386
>Organization:
School of Mathematics, Trinity College Dublin, Ireland.
>Environment:

	If you run restore with cwd on an nfs3 filesystem (say)
	where the blocksize is less than 1024, restore will give
	a bus error.

>Description:

	The logic in tape.c:getfile() doesn't allow for a filesystem
	with a blocksize smaller than the tape block size. The problem
	seems to be most easily fixed by changeing where fssize is set. 

>How-To-Repeat:

	cd /nfs3 
	cat dump | restore ivbf 2 - 

>Fix:
	
	This diff changes the setting of fssize, so that if the filesystem
	blocksize is too small it is set to the minimum (TP_BSIZE), otherwise
	the logic is as before.


--- /usr/src/sbin/restore/tape.c	Thu Jan 29 22:26:11 1998
+++ tape.c	Tue Feb 10 18:17:31 1998
@@ -231,7 +231,9 @@
 		fprintf(stderr, "cannot stat .: %s\n", strerror(errno));
 		done(1);
 	}
-	if (stbuf.st_blksize > 0 && stbuf.st_blksize <= MAXBSIZE)
+	if (stbuf.st_blksize > 0 && stbuf.st_blksize < TP_BSIZE )
+		fssize = TP_BSIZE;
+	if (stbuf.st_blksize >= TP_BSIZE && stbuf.st_blksize <= MAXBSIZE)
 		fssize = stbuf.st_blksize;
 	if (((fssize - 1) & fssize) != 0) {
 		fprintf(stderr, "bad block size %d\n", fssize);

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jkh 
State-Changed-When: Mon Mar 23 15:15:04 PST 1998 
State-Changed-Why:  
Suggested fix applied, thanks. 
>Unformatted:
