*BSD News Article 67531


Return to BSD News archive

Newsgroups: comp.bugs.2bsd
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!spool.mu.edu!howland.reston.ans.net!newsfeed.internetmci.com!salliemae!europa.chnt.gtegsc.com!wlbr!moe!sms
From: sms@moe.2bsd.com (Steven M. Schultz)
Subject: standalone disklabel miscalculates d_npartitions (#317)
Organization: 2BSD, Simi Valley CA USA
Message-ID: <DqtBuo.G1@moe.2bsd.com>
Date: Fri, 3 May 1996 04:44:48 GMT
Lines: 93

Subject: standalone disklabel miscalculates d_npartitions (#317)
Index:	pdpstand/disklabel.c 2.11BSD

Description:
	The standalone disklabel program does not correctly set the
	number of partitions correctly when an even number of partitions
	are active.

Repeat-By:
	From a boot floppy or tape load the disklabel program and attempt
	to create a label containing only the 'a' and 'b' partitions.  Note
	that 'd_npartitions' remains set at 1.  This causes the 'b' partition
	information to be ignored by the kernel.

Fix:
	This was a classic (i.e. dumb) mistake of having '>' where a '>='
	was needed.

	Thanks to Tim Shoppa for spotting this one and tracking it down.

	Cut where indicated, saving to a file (/tmp/317) and then:

			patch -p0 < /tmp/317
			cd /sys/pdpstand
			make

	If you have any boot floppies or other "in case of emergency break
	glass" boot media you may wish to recreate them at this time using
	the 'maketape' program:

			cd /sys/pdpstand
			./maketape /dev/nrmt0 maketape.data
			dump 0u /dev/rmt0 /

	(substituting for /dev/nrmt0 and /dev/rmt0 as appropriate for your
	 system).

	This will create an emergency boot kit containing a dump of the root
	filesystem.

	This and previous updates are available via anonymous FTP to either
	FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the directory /pub/2.11BSD.

-----------------------------cut here------------------------
*** /sys/pdpstand/disklabel.c.old	Sun Jan 21 14:18:18 1996
--- /sys/pdpstand/disklabel.c	Thu May  2 20:46:28 1996
***************
*** 1,7 ****
  /*
   * Public domain, June 1995
   *
!  *	@(#)disklabel.c	1.3 (2.11BSD GTE) 1996/1/21
  */
  
  #define	DKTYPENAMES
--- 1,7 ----
  /*
   * Public domain, June 1995
   *
!  *	@(#)disklabel.c	1.4 (2.11BSD GTE) 1996/5/2
  */
  
  #define	DKTYPENAMES
***************
*** 362,368 ****
  				i = getpartnum();
  				if	(i < 0)
  					break;
! 				if	(i > lp->d_npartitions)
  					lp->d_npartitions = i + 1;
  				dopartmods(lp, i);
  				break;
--- 362,368 ----
  				i = getpartnum();
  				if	(i < 0)
  					break;
! 				if	(i >= lp->d_npartitions)
  					lp->d_npartitions = i + 1;
  				dopartmods(lp, i);
  				break;
*** /VERSION.old	Sat Apr 20 20:38:57 1996
--- /VERSION	Thu May  2 21:17:40 1996
***************
*** 1,4 ****
! Current Patch Level: 316
  
  2.11 BSD
  ============
--- 1,4 ----
! Current Patch Level: 317
  
  2.11 BSD
  ============