Date: Mon, 06 Sep 2004 10:19:01 -0600 From: Scott Long <scottl@samsco.org> To: Xin LI <delphij@frontfree.net> Cc: FreeBSD-qa@freebsd.org Subject: Re: [PATCH] Only make one active partition in sysinstall(8) Message-ID: <413C8DF5.5050308@samsco.org> In-Reply-To: <20040905164836.451FF130C42@beastie.frontfree.net> References: <20040905164836.451FF130C42@beastie.frontfree.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Xin, Please feel free to commit this to HEAD right now and get it reviewed for RELENG_5. Thanks! Scott Xin LI wrote: >>Submitter-Id: current-users >>Originator: Xin LI >>Organization: The FreeBSD Simplified Chinese Project >>Confidential: no >>Synopsis: [PATCH] Only make one active partition in sysinstall(8) >>Severity: serious >>Priority: high >>Category: bin >>Class: sw-bug >>Release: FreeBSD 5.2-delphij i386 >>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 --- > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?413C8DF5.5050308>