From fj@schizo.dk.tfs.com  Mon Jan 20 09:10:26 1997
Received: from tfs.com (tfs.com [140.145.250.1])
          by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id JAA12183
          for <FreeBSD-gnats-submit@freebsd.org>; Mon, 20 Jan 1997 09:10:26 -0800 (PST)
Received: from schizo.dk.tfs.com by tfs.com (smail3.1.28.1) with SMTP
	id m0vmNEJ-0003wqC; Mon, 20 Jan 97 09:09 PST
Received: (from fj@localhost) by schizo.dk.tfs.com (8.8.2/8.7.3) id SAA28651; Mon, 20 Jan 1997 18:09:53 +0100 (MET)
Message-Id: <199701201709.SAA28651@schizo.dk.tfs.com>
Date: Mon, 20 Jan 1997 18:09:53 +0100 (MET)
From: fj@tfs.com
Reply-To: fj@tfs.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: Fsck dies with floatingpoint exception
X-Send-Pr-Version: 3.2

>Number:         2537
>Category:       bin
>Synopsis:       Fsck dies with floatingpoint exception
>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:   Mon Jan 20 09:20:01 PST 1997
>Closed-Date:    Mon Jan 19 08:28:39 PST 1998
>Last-Modified:  Mon Jan 19 08:33:37 PST 1998
>Originator:     Flemming Jacobsen
>Release:        FreeBSD 2.2-RELEASE i386
>Organization:
>Environment:

	FreeBSD 2.2 beta, as generated by PHK 970114.

	System crashed (bad memory) during intense IO to disk.

>Description:

	At reboot automatic fsck failed with the message:
	  VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE
	(setup.c line 384)

	Running fsck by hand (on the primary superblock) resulted in a 
	floatingpoint exception (probably caused by the printf in main.c
	with [(float)(sblock.fs_cstotal.cs_nffree * 100) / sblock.fs_dsize)]).
	I did retry after setting the npx0 flags to 0x7 - same result.

	fsck -b 32  avoided the problem.

>How-To-Repeat:

	Good question ;-)

>Fix:
	
	fsck -b {better superblock copy}

	Fix fsck to check for divide by zero before trying.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: bde 
State-Changed-When: Mon Jan 19 08:28:39 PST 1998 
State-Changed-Why:  
fsck problem fixed in rev.1.8 of fsck/setup.c (fsck trusted newfs). 
newfs problem created in rev.1.9 of newfs/newfs.c not yet fixed 
(newfs neglects to write label info used by fsck when the first 
superblock is bad). 
>Unformatted:
