NetBSD Problem Report #466

From gnats  Thu Sep  8 13:37:35 1994
Received: from rafal.slip.uiuc.edu (root@ruger-89.slip.uiuc.edu [128.174.107.108]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id NAA00474 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Thu, 8 Sep 1994 13:37:24 -0700
Message-Id: <199409070938.EAA00639@rafal.slip.uiuc.edu>
Date: Wed, 7 Sep 1994 04:38:31 -0500
From: Rafal Boni <rafal@rafal.slip.uiuc.edu>
Reply-To: r-boni@uiuc.edu
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Cc: rafal@bonehead.aiss.uiuc.edu
Subject: i386 disklabel STILL clobbers DOS part. table!
X-Send-Pr-Version: 3.2

>Number:         466
>Category:       bin
>Synopsis:       i386 disklabel STILL clobbers DOS part table if exists!
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 08 14:05:24 +0000 1994
>Closed-Date:    Sun Sep 18 22:11:09 +0000 1994
>Last-Modified:  
>Originator:     Rafal Boni
>Release:        1.0_BETA as of 9/1
>Organization:
	...me organized?? Huh!
>Environment:

System: NetBSD rafal.slip.uiuc.edu 1.0_BETA NetBSD 1.0_BETA (RAFAL) #4: Mon Sep 5 19:15:47 CDT 1994 rafal@rafal.slip.uiuc.edu:/usr/src/sys/arch/i386/compile/RAFAL i386

No SCSI, 2 x ESDI drives [wd0 and wd1], both shared with MS-DOS.


>Description:

	The i386 disklabel will now ask you if you want to clobber your MBR,
	but there is NO way to [re-]label disks without doing so...

	The disklabel program had a hardcoded reference to the c partition 
	as the raw partition in one of the #if i386 blocks.  As a result, the 
	sanity checks that followed would almost always fail... and the only
	way to then do the labeling would be to trash the DOS MBR.

	On top of this, restoring the DOS MBR would nullify the labeling done
	above since it was written to the wrong place!

>How-To-Repeat:

	On a disk shared between DOS and BSD [and whose MBR you have saved],
	do a "disklabel -B <drive>".

	Watch the label be written out on top of the DOS MBR, thus trashing it
	INSTEAD of to the 'd' partition of said drive.

>Fix:

	In /usr/src/sbin/disklabel apply following patch, which also clarifies
	the goofy message you get when disklabel IS about to clobber your DOS
	MBR:

*** disklabel.c.old	Wed Sep  7 04:07:27 1994
--- disklabel.c	Wed Sep  7 04:05:41 1994
***************
*** 387,393 ****
  	lp->d_checksum = dkcksum(lp);
  	if (rflag) {
  #ifdef i386
! 		struct partition *pp = &lp->d_partitions[2];
  		/*
  		 * If NetBSD/i386 DOS partition is missing, or if 
  		 * the label to be written is not within partition,
--- 387,393 ----
  	lp->d_checksum = dkcksum(lp);
  	if (rflag) {
  #ifdef i386
! 		struct partition *pp = &lp->d_partitions[RAWPARTITION - 'a'];
  		/*
  		 * If NetBSD/i386 DOS partition is missing, or if 
  		 * the label to be written is not within partition,
***************
*** 404,410 ****
  			if (dosdp) {
  				int c;

! 				printf("overwriting disk with DOS partition table? (n): ");
  				fflush(stdout);
  				c = getchar();
  				if (c != EOF && c != '\n')
--- 404,410 ----
  			if (dosdp) {
  				int c;

! 				printf("overwrite DOS partition table? (n): ");
  				fflush(stdout);
  				c = getchar();
  				if (c != EOF && c != '\n')


	This patch seems completely wrong.  Since 386BSD, the `c'
	partition has been intended to correspond with the {386,Net}BSD
	partition listed in the DOS partition table.  The `d' partition
	is intended to be the whole disk.  As far as I can tell, you
	have them backwards.  If there is a problem with setting up the
	label in the `correct' way, please submit a corrected PR.
	- mycroft

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Sun Sep 18 15:11:09 PDT 1994 
State-Changed-Why:  
This report is incorrect. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.