Subject: install/7556: sysinst rounding problem
To: None <gnats-bugs@gnats.netbsd.org>
From: None <arnej@math.ntnu.no>
List: netbsd-bugs
Date: 05/11/1999 14:21:18
>Number:         7556
>Category:       install
>Synopsis:       sysinst rounding problem
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 11 14:20:00 1999
>Last-Modified:
>Originator:     Arne Juul
>Organization:
	NUTS - Norwegian University of Technology and Science
>Release:        NetBSD-1.4 aka sup-of-today
>Environment:

System: NetBSD fimfpc30.math.ntnu.no 1.4 NetBSD 1.4 (GENERIC) #0: Fri May 7 11:46:56 CEST 1999 root@fimfpc30.math.ntnu.no:/usr/src/sys/arch/i386/compile/GENERIC i386

>Description:
	sysinst sometimes displays the wrong number for "cylinder end",
	in my case one MB (and one cylinder!) more than the correct
	number for the first partition (a DOS partition starting on
	sector 63 and ending on a cylinder boundary, and that's pretty
	common).  It turns out this is due to a typo in sysinst.
	There are still problems with using MB as your allocation unit
	after this, sadly :-(
>How-To-Repeat:
	Use sysinst to "fdisk" your i386 machine, using megabytes, check
	whether the sector counts are OK, and you will probably find this.
	Then inspect code :-)
>Fix:

--- src/distrib/utils/sysinst/mbr.c.orig	Mon May  3 13:04:48 1999
+++ src/distrib/utils/sysinst/mbr.c	Tue May 11 22:58:21 1999
@@ -379,7 +379,7 @@
 			if (part[i].mbrp_size % sizemult)
 				rsize++;
 			rend = (part[i].mbrp_start + part[i].mbrp_size) / sizemult;
-			if ((part[i].mbrp_size + part[i].mbrp_size) % sizemult)
+			if ((part[i].mbrp_start + part[i].mbrp_size) % sizemult)
 				rend++;
 			msg_printf_add("%d %12d%12d%12d  ", i,
 			    part[i].mbrp_start / sizemult, rsize, rend);
>Audit-Trail:
>Unformatted: