From tegge@itea.ntnu.no  Sun Oct 13 14:49:29 1996
Received: from istind.itea.unit.no (istind.itea.unit.no [129.241.190.12])
          by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id OAA07623
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 13 Oct 1996 14:48:23 -0700 (PDT)
Received: from skarven.itea.ntnu.no (tegge@skarven.itea.ntnu.no [129.241.190.13]) by istind.itea.unit.no (8.6.12/1.9.AHJ) with ESMTP id VAA25572 for <FreeBSD-gnats-submit@freebsd.org>; Sun, 13 Oct 1996 21:48:10 GMT
Received: (from tegge@localhost) by skarven.itea.ntnu.no (8.7.6/8.7.3) id XAA02104; Sun, 13 Oct 1996 23:48:09 +0200 (MET DST)
Message-Id: <199610132148.XAA02104@skarven.itea.ntnu.no>
Date: Sun, 13 Oct 1996 23:48:09 +0200 (MET DST)
From: Tor Egge <tegge@itea.ntnu.no>
Reply-To: tegge@itea.ntnu.no
To: FreeBSD-gnats-submit@freebsd.org
Subject: dump estimates a negative number of tapes needed for huge dumps
X-Send-Pr-Version: 3.2

>Number:         1789
>Category:       bin
>Synopsis:       dump estimates a negative number of tapes needed for huge dumps
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pst
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 13 14:50:01 PDT 1996
>Closed-Date:    Tue Jan 7 12:16:02 PST 1997
>Last-Modified:  Tue Jan  7 12:16:22 PST 1997
>Originator:     Tor Egge
>Release:        FreeBSD 2.2-CURRENT i386
>Organization:
Norwegian University of Science and Technology, Trondheim, Norway

>Environment:

FreeBSD skarven.itea.ntnu.no 2.2-CURRENT FreeBSD 2.2-CURRENT #0: Fri Oct 11 23:58:42  1996     root@skarven.itea.ntnu.no:/usr/src/sys/compile/SKARVEN  i386

>Description:

skarven# df -k /export/ftpsearch1 
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/sd2a     4175707  3352892   697544    83%    /export/ftpsearch1
skarven# dump 0f /dev/null /dev/rsd2a
  DUMP: Date of this level 0 dump: Sun Oct 13 23:16:13 1996
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rsd2a (/export/ftpsearch1) to /dev/null
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 3355778 tape blocks on -10.93 tape(s).
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
[...]

>How-To-Repeat:

	dump a big filesystem (more than 2 GB used).

>Fix:
	
	cast tapesize to double in the expression that
	calculates fetapes to avoid wraparound.

Index: main.c
===================================================================
RCS file: /export/ftpsearch3/cvs/src/sbin/dump/main.c,v
retrieving revision 1.7
diff -u -r1.7 main.c
--- main.c	1996/09/14 02:57:39	1.7
+++ main.c	1996/10/13 21:40:12
@@ -368,7 +368,7 @@
 			   Assume no erroneous blocks; this can be compensated
 			   for with an artificially low tape size. */
 			fetapes =
-			(	  tapesize	/* blocks */
+			(	  (double) tapesize	/* blocks */
 				* TP_BSIZE	/* bytes/block */
 				* (1.0/density)	/* 0.1" / byte " */
 			  +
@@ -381,7 +381,7 @@
 			   tape */
 			int tenthsperirg = (density == 625) ? 3 : 7;
 			fetapes =
-			(	  tapesize	/* blocks */
+			(	  (double) tapesize	/* blocks */
 				* TP_BSIZE	/* bytes / block */
 				* (1.0/density)	/* 0.1" / byte " */
 			  +


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->pst 
Responsible-Changed-By: pst 
Responsible-Changed-When: Thu Oct 17 10:30:18 PDT 1996 
Responsible-Changed-Why:  
I'll fix it. 
State-Changed-From-To: open->closed 
State-Changed-By: pst 
State-Changed-When: Tue Jan 7 12:16:02 PST 1997 
State-Changed-Why:  
Fixed, thank you for your patch. 
>Unformatted:
