Received: from SOUTH-STATION-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA16132; Fri, 15 Mar 96 15:09:07 EST
Received: from pain.lcs.mit.edu by MIT.EDU with SMTP
	id AA28484; Fri, 15 Mar 96 15:08:20 EST
Received: (from daemon@localhost) by pain.lcs.mit.edu (8.7.4/8.6.12) id OAA25965; Fri, 15 Mar 1996 14:32:30 -0500 (EST)
Received: from firewall.mc.com by pain.lcs.mit.edu (8.7.4/8.6.12) with SMTP id OAA25908; Fri, 15 Mar 1996 14:13:29 -0500 (EST)
Received: by firewall.mc.com id AA05203
  (5.65c/IDA-1.4.4); Fri, 15 Mar 1996 14:13:18 -0500
Received: from jericho.mc.com(192.233.16.4) by firewall via smap (V1.3)
	id sma005198; Fri Mar 15 14:13:06 1996
Received: from bach (bach [192.233.16.203]) by jericho (8.6.11/8.6.11) with SMTP id OAA27294; Fri, 15 Mar 1996 14:13:04 -0500
From: "Gordon W. Ross" <gwr@mc.com>
Received: by bach 
        (4.1//ident-1.0) id AA07553; Fri, 15 Mar 96 14:13:03 EST 
Date: Fri, 15 Mar 96 14:13:03 EST
Message-Id: <9603151913.AA07553@bach>
To: mycroft@NetBSD.ORG, perry@piermont.com
Cc: netbsd-developers@NetBSD.ORG
In-Reply-To: <9603151847.AA07541@bach> (gwr)
Subject: NetBSD/i386 trashed my FDISK table!
Sender: owner-netbsd-developers@NetBSD.ORG
Precedence: first-class
X-Loop: netbsd-developers@NetBSD.ORG

I want to "rub your noses in this" a little...

> From: "Gordon W. Ross" <gwr>
> Date: Fri, 15 Mar 96 13:47:19 EST
> 
> I am very disappointed.  I tried to setup a SCSI disk shared between
> NetBSD-1.1 and MSDOS-6.2 and NetBSD trashed the FDISK table!
[...see port-i386...]
> There is really NO EXCUSE for NetBSD to go trash some other
> FDISK partion, EVER.  I think the disklabel stuff is broken.
> 
> I guess I'll have a go at fixing this...

I looked at i386/disklabel.c and I found some things that look
very questionable.  If there is no FDISK label, readdisklabel
will assume it can use sector zero.  I believe it should NOT
assume it can write on the disk without an FDISK label, at least
not without some confirmation from the user.  If there is no
FDISK label, only the 'd' partition should work.

The fdisk program (or pfdisk or whatever) can use the 'd' partition
to create an entry in the FDISK table.  Until that has been done,
the writedisklabel() function should refuse to write a label.

Once there is an entry for NetBSD in the FDISK table, the NetBSD
disklabel should be located (ONLY) by finding the "type 0xA5"
FDISK entry (whether active or not) and using the first sector
of that FDISK partition (which now appears as the 'c' slice).
ONLY THEN, is it appropriate to write the NetBSD disklabel!

I can't believe what I found in i386/disksubr.c (yikes!)
That business about copying FDISK slots into the netbsd label
is pretty bogus - if I want to make partitions matching the
FDISK ones, I can do that, but readdisklabel should not.
The knowledge of FAT types is completely bogus too...

Can anyone explain what they were trying to do in there?

By the way, I'm sorry for the anger in my tone...
I get that way when S/W bugs trash my disk...

Gordon
