NetBSD Problem Report #9590

Received: (qmail 6823 invoked from network); 9 Mar 2000 15:51:45 -0000
Message-Id: <200003091550.QAA06534@horn.ics.muni.cz>
Date: Thu, 9 Mar 2000 16:50:32 +0100 (MET)
From: salvet@ics.muni.cz
Reply-To: salvet@ics.muni.cz
To: gnats-bugs@gnats.netbsd.org, gsollish@mail.gisco.net, frank@wins.uva.nl,
        toddpw@best.com
Subject: disklabel -r -R clobbers boot code on i386 (+fix)
X-Send-Pr-Version: 3.95

>Number:         9590
>Category:       port-i386
>Synopsis:       disklabel -r -R clobbers boot code on i386
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-i386-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 09 07:54:00 +0000 2000
>Closed-Date:    Sat Mar 13 12:32:44 +0000 2004
>Last-Modified:  Sat Mar 13 12:32:44 +0000 2004
>Originator:     Zdenek Salvet
>Release:        1.4.1
>Organization:
Masaryk University, Brno, Czech Republic
>Environment:
	i386-1.4.1, i386-1.4.2, -current of Mar 9, 2000
>Description:
>How-To-Repeat:

disklabel wd0 >wd0.label
# edit, e.g. to add MSDOS partition
disklabel -r -R wd0 wd0.label
reboot

   << watch bootselector return error 3 >>
   << recover by running installboot from floppy >>

>Fix:
Add MBR support to SAVEBOOTAREA code and define SAVEBOOTAREA
for i386.
patch against current of Thu Mar  9, 2000:
(apply in /usr/src/sbin)

diff -ur disklabel/Makefile disklabel.new/Makefile
--- disklabel/Makefile	Tue Feb  1 04:14:19 2000
+++ disklabel.new/Makefile	Thu Mar  9 09:00:44 2000
@@ -7,13 +7,6 @@
 LDADD+= -lutil
 DPADD+= ${LIBUTIL}

-.if (${MACHINE} == "i386")
-# recognize old partition ID for a while
-CPPFLAGS+= -DCOMPAT_386BSD_MBRPART
-# use MBR partition info
-CPPFLAGS+= -DUSE_MBR
-.endif
-
 .if (${MACHINE} == "hp300") || (${MACHINE} == "vax") \
 	|| (${MACHINE} == "arm32")
 CPPFLAGS+= -DNUMBOOT=1
@@ -31,7 +24,7 @@
 CPPFLAGS+= -DSAVEBOOTAREA
 .endif

-.if (${MACHINE} == "hpcmips" || ${MACHINE} == "arc")
+.if (${MACHINE} == "hpcmips" || ${MACHINE} == "arc" || ${MACHINE} == "i386")
 # recognize old partition ID for a while
 CPPFLAGS+= -DCOMPAT_386BSD_MBRPART
 # use MBR partition info
diff -ur disklabel/disklabel.c disklabel.new/disklabel.c
--- disklabel/disklabel.c	Tue Feb  1 04:14:19 2000
+++ disklabel.new/disklabel.c	Thu Mar  9 08:56:47 2000
@@ -894,6 +894,10 @@
 	if (rflag) {
 		off_t sectoffset = 0;

+#ifdef USE_MBR
+		if (dosdp)
+			sectoffset = (off_t)dosdp->mbrp_start * DEV_BSIZE;
+#endif
 		if (lseek(f, sectoffset, SEEK_SET) < 0 ||
 		    read(f, boot, BBSIZE) < BBSIZE)
 			err(4, "%s", specname);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: rtr 
State-Changed-When: Mon Jun 23 15:23:45 UTC 2003 
State-Changed-Why:  
It would appear that the included patch or possibly an independantly developed 
variant has been incorporated into disklabel(8) for some time. 

I cannot repeat it with the described method, can the submitter please 
confirm whether or not this problem has been resolved. 
State-Changed-From-To: feedback->closed 
State-Changed-By: dsl 
State-Changed-When: Sat Mar 13 12:31:33 UTC 2004 
State-Changed-Why:  
no feedback, and this is fixed. 
>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.