Subject: port-i386/13137: fdisk -B unable to remove bootselect labels for deleted partitions
To: None <>
From: None <>
List: netbsd-bugs
Date: 06/07/2001 16:37:15
>Number:         13137
>Category:       port-i386
>Synopsis:       fdisk -B unable to remove bootselect labels for deleted partitions
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 07 16:36:00 PDT 2001
>Originator:     Jesse Off
>Release:        1.5.1_BETA2
	NewMonics, Inc.
System: NetBSD vast 1.5.1_BETA2 NetBSD 1.5.1_BETA2 (VAST) #6: Wed Jun 6 15:58:48 MST 2001 joff@vast:/u/src/sys/arch/i386/compile/VAST i386

	fdisk -B does not let you remove obsolete labels for UNUSED
	partitions in the mbr after they have been marked UNUSED.
	Hence, when a user deletes an operating system and removes
	it's partition, there is no way to delete option from bootup
	screen without major hackery.

	Create a partition, install an OS (lets say Linux) on that
	partition and label it for mbr_bootsel (perhaps call it
	"RedHat") using fdisk.  Then, delete the partition ( make
	it <UNUSED>) using NetBSD fdisk.  Then, try to remove
	"RedHat" from the bootselect options by using "fdisk -B".
	Notice that fdisk will not let you because before it lets
	you modify the label string, it makes a check to make sure
	the partition is valid.  Since the partition is deleted, it 
	will not let you change the label string.

The following patch removes the check to see if the entry is invalid,
thereby letting the user input a blank string and removing the
option from the bootselect display. 

Index: fdisk.c
RCS file: /cvsroot/basesrc/sbin/fdisk/fdisk.c,v
retrieving revision 1.41
diff -u -r1.41 fdisk.c
--- fdisk.c     2000/06/14 19:35:50     1.41
+++ fdisk.c     2001/06/07 23:19:48
@@ -794,11 +794,6 @@
                        item = -1;
-               if ([item].mbrp_typ == 0) {
-                       printf("The partition entry is unused\n");
-                       item = -1;
-                       continue;
-               }

                printf("Enter descriptions (max. 8 characters): ");