From owner-freebsd-bugs@FreeBSD.ORG Sun Sep 5 16:50:23 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BBAE216A4CE for ; Sun, 5 Sep 2004 16:50:23 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9D4A143D49 for ; Sun, 5 Sep 2004 16:50:23 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i85GoLbG033064 for ; Sun, 5 Sep 2004 16:50:21 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i85GoKph033063; Sun, 5 Sep 2004 16:50:20 GMT (envelope-from gnats) Resent-Date: Sun, 5 Sep 2004 16:50:20 GMT Resent-Message-Id: <200409051650.i85GoKph033063@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Xin LI Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CB17B16A4CE for ; Sun, 5 Sep 2004 16:49:01 +0000 (GMT) Received: from mail.freebsd.org.cn (dns3.freebsd.org.cn [61.129.66.75]) by mx1.FreeBSD.org (Postfix) with SMTP id 4E64943D5A for ; Sun, 5 Sep 2004 16:48:56 +0000 (GMT) (envelope-from delphij@frontfree.net) Received: (qmail 20443 invoked by uid 0); 5 Sep 2004 16:45:33 -0000 Received: from unknown (HELO beastie.frontfree.net) (219.239.98.7) by mail.freebsd.org.cn with SMTP; 5 Sep 2004 16:45:33 -0000 Received: from localhost (localhost.frontfree.net [127.0.0.1]) by beastie.frontfree.net (Postfix) with ESMTP id 8416E131015; Mon, 6 Sep 2004 00:48:41 +0800 (CST) Received: from beastie.frontfree.net ([127.0.0.1]) by localhost (beastie.frontfree.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02236-07; Mon, 6 Sep 2004 00:48:37 +0800 (CST) Received: by beastie.frontfree.net (Postfix, from userid 1001) id 451FF130C42; Mon, 6 Sep 2004 00:48:36 +0800 (CST) Message-Id: <20040905164836.451FF130C42@beastie.frontfree.net> Date: Mon, 6 Sep 2004 00:48:36 +0800 (CST) From: Xin LI To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: re@FreeBSD.org cc: FreeBSD-qa@FreeBSD.org Subject: bin/71404: [PATCH] Only make one active partition in sysinstall(8) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Xin LI List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2004 16:50:23 -0000 >Number: 71404 >Category: bin >Synopsis: [PATCH] Only make one active partition in sysinstall(8) >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Sep 05 16:50:20 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Xin LI >Release: FreeBSD 5.2-delphij i386 >Organization: The FreeBSD Simplified Chinese Project >Environment: System: FreeBSD beastie.frontfree.net 5.2-delphij FreeBSD 5.2-delphij #0: Tue Aug 17 14:22:25 CST 2004 delphij@beastie.frontfree.net:/usr/obj/usr/src/sys/BEASTIE i386 >Description: The handling of active partition in sysinstall(8) contained a minor flaw that allows two partitions to be marked as "active" in the same time. Before having a user shoot his or her feet, I think it would be a good idea not permitting this at all. >How-To-Repeat: Run sysinstall(8), Configure -> Fdisk -> (choose a disk having more than one partition) -> try to use "S" on more than one partition. >Fix: The attached patch would reset active states in the whole partition chain and hence won't allow two partitions to be set "active" at the same time. Might be a good candidate for the upcoming 5.3-RELEASE. Along with the functional patch I have added a "CHUNK_INFO_ENTRIES" define to make it easier to have consist code. --- patch-sysinstall::disks.c begins here --- Index: disks.c =================================================================== RCS file: /home/fcvs/src/usr.sbin/sysinstall/disks.c,v retrieving revision 1.152 diff -u -r1.152 disks.c --- disks.c 2 Aug 2004 23:18:48 -0000 1.152 +++ disks.c 5 Sep 2004 16:39:22 -0000 @@ -74,7 +74,8 @@ #define CHUNK_START_ROW 5 /* Where we keep track of MBR chunks */ -static struct chunk *chunk_info[16]; +#define CHUNK_INFO_ENTRIES 16 +static struct chunk *chunk_info[CHUNK_INFO_ENTRIES]; static int current_chunk; static void diskPartitionNonInteractive(Device *dev); @@ -312,6 +313,7 @@ { char *cp, *p; int rv, key = 0; + int i; Boolean chunking; char *msg = NULL; #ifdef PC98 @@ -535,6 +537,10 @@ break; case 'S': + /* Clear active states so we won't have two */ + for (i = 0; (chunk_info[i] != NULL) && (i < CHUNK_INFO_ENTRIES); i++) + chunk_info[i]->flags &= !CHUNK_ACTIVE; + /* Set Bootable */ chunk_info[current_chunk]->flags |= CHUNK_ACTIVE; break; --- patch-sysinstall::disks.c ends here --- >Release-Note: >Audit-Trail: >Unformatted: