From nobody@FreeBSD.org  Fri May  7 01:49:47 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E42DC16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  7 May 2004 01:49:47 -0700 (PDT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id BC12A43D72
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  7 May 2004 01:49:47 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i478nlAx009936
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 7 May 2004 01:49:47 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i478nlmP009935;
	Fri, 7 May 2004 01:49:47 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200405070849.i478nlmP009935@www.freebsd.org>
Date: Fri, 7 May 2004 01:49:47 -0700 (PDT)
From: Cedric DEVILLERS <cedric.devillers@script.jussieu.fr>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sysinstall create a partition of subtype=3 ( and not 165 ) in non-interactive mode
X-Send-Pr-Version: www-2.3

>Number:         66350
>Category:       bin
>Synopsis:       sysinstall(8): sysinstall creates a partition of subtype=3 ( and not 165 ) in non-interactive mode
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    brucec
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 07 01:50:23 PDT 2004
>Closed-Date:    Sat Aug 07 11:18:00 UTC 2010
>Last-Modified:  Sat Aug  7 11:20:05 UTC 2010
>Originator:     Cedric DEVILLERS
>Release:        5.1 RELEASE but it seems to be present in 5.2 and 5.2.1 releases too
>Organization:
SCRIPT - Univ. Paris 7
>Environment:
FreeBSD machin.truc.bidule 5.1-RELEASE FreeBSD 5.1-RELEASE #0: Thu Jun 5 02:55:42 GMT 2003 root@wv1u.btc.adactec.com:/usr/obj/usr/src/sys/GENERIC i386
>Description:
When sysinstall is executed in NonInteractive mode, the command "diskPartitionEditor" create a partition with a subtype equal to 3 ( and not 165 ) for a freebsd partition. So the rest of the install fails.

>How-To-Repeat:
install.cfg must contain the following lines :

nonInteractive=YES
disk=ad0
partition=free # or partition=1024M for example
bootManager=none
diskPartitionEditor

>Fix:
Correct the /usr/src/usr.sbin/sysinstall/disks.c file :
in the diskPartitionNonInteractive subroutine, change the subtype=3 in the call of Create_Chunk to the SUBTYPE_FREEBSD value, in the "free" choice and in the "partition size" choice.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-qa 
Responsible-Changed-By: rodrigc 
Responsible-Changed-When: Wed Oct 5 03:44:13 GMT 2005 
Responsible-Changed-Why:  
sysinstall bug 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66350 
Responsible-Changed-From-To: freebsd-bugs->matteo 
Responsible-Changed-By: matteo 
Responsible-Changed-When: Lun 11 Feb 2008 06:44:19 UTC 
Responsible-Changed-Why:  
I have a perforce branch for sysinstall bugfixes and will coordinate with kensmith@ to have it merged after the -RELEASE dance 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66350 
Responsible-Changed-From-To: matteo->brucec  
Responsible-Changed-By: brucec 
Responsible-Changed-When: Sun Apr 25 12:07:53 UTC 2010 
Responsible-Changed-Why:  
Grab. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66350 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/66350: commit references a PR
Date: Wed, 16 Jun 2010 15:41:19 +0000 (UTC)

 Author: brucec
 Date: Wed Jun 16 15:40:13 2010
 New Revision: 209235
 URL: http://svn.freebsd.org/changeset/base/209235
 
 Log:
   * Allow partial MB/GB values to be entered in the slice and label editors.
   * Don't strdup the name when calling deviceRegister because the string is
   copied within new_device.
   * Use a subtype of 165, not 3, when creating a slice in noninteractive
   mode.
   
   PR: bin/135333
   PR: bin/66350
   Approved by: rrs (mentor)
   MFC after: 1 month
 
 Modified:
   head/usr.sbin/sysinstall/devices.c
   head/usr.sbin/sysinstall/disks.c
   head/usr.sbin/sysinstall/label.c
 
 Modified: head/usr.sbin/sysinstall/devices.c
 ==============================================================================
 --- head/usr.sbin/sysinstall/devices.c	Wed Jun 16 15:09:45 2010	(r209234)
 +++ head/usr.sbin/sysinstall/devices.c	Wed Jun 16 15:40:13 2010	(r209235)
 @@ -295,6 +295,8 @@ deviceGetAll(void)
  
      msgNotify("Probing devices, please wait (this can take a while)...");
      /* First go for the network interfaces.  Stolen shamelessly from ifconfig! */
 +    memset(&ifc, 0, sizeof(ifc));
 +    memset(buffer, 0, INTERFACE_MAX * sizeof(struct ifreq));
      ifc.ifc_len = sizeof(buffer);
      ifc.ifc_buf = buffer;
  
 @@ -371,7 +373,7 @@ skipif:
  
  		    if (fd >= 0) close(fd);
  		    snprintf(n, sizeof n, device_names[i].name, j);
 -		    deviceRegister(strdup(n), device_names[i].description, strdup(try),
 +		    deviceRegister(n, device_names[i].description, strdup(try),
  					 DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM,
  					 mediaShutdownCDROM, NULL);
  		    if (isDebug())
 @@ -390,7 +392,7 @@ skipif:
  
  		    close(fd);
  		    snprintf(n, sizeof n, device_names[i].name, j);
 -		    deviceRegister(strdup(n), device_names[i].description, strdup(try),
 +		    deviceRegister(n, device_names[i].description, strdup(try),
  				   DEVICE_TYPE_FLOPPY, TRUE, mediaInitFloppy, mediaGetFloppy,
  				   mediaShutdownFloppy, NULL);
  		    if (isDebug())
 @@ -405,7 +407,7 @@ skipif:
  
  			close(fd);
  			snprintf(n, sizeof(n), device_names[i].name, j);
 -			deviceRegister(strdup(n), device_names[i].description,
 +			deviceRegister(n, device_names[i].description,
  			    strdup(try), DEVICE_TYPE_USB, TRUE, mediaInitUSB,
  			    mediaGetUSB, mediaShutdownUSB, NULL);
  
 
 Modified: head/usr.sbin/sysinstall/disks.c
 ==============================================================================
 --- head/usr.sbin/sysinstall/disks.c	Wed Jun 16 15:09:45 2010	(r209234)
 +++ head/usr.sbin/sysinstall/disks.c	Wed Jun 16 15:40:13 2010	(r209235)
 @@ -479,6 +479,7 @@ diskPartition(Device *dev)
  	    else {
  		char *val, tmp[20], name[16], *cp;
  		daddr_t size;
 +		long double dsize;
  		int subtype;
  		chunk_e partitiontype;
  #ifdef PC98
 @@ -493,11 +494,20 @@ diskPartition(Device *dev)
  		snprintf(tmp, 20, "%jd", (intmax_t)chunk_info[current_chunk]->size);
  		val = msgGetInput(tmp, "Please specify the size for new FreeBSD slice in blocks\n"
  				  "or append a trailing `M' for megabytes (e.g. 20M).");
 -		if (val && (size = strtoimax(val, &cp, 0)) > 0) {
 +		if (val && (dsize = strtold(val, &cp)) > 0 && dsize < UINT32_MAX) {
  		    if (*cp && toupper(*cp) == 'M')
 -			size *= ONE_MEG;
 +			size = (daddr_t) (dsize * ONE_MEG);
  		    else if (*cp && toupper(*cp) == 'G')
 -			size *= ONE_GIG;
 +			size = (daddr_t) (dsize * ONE_GIG);
 +		    else
 +			size = (daddr_t) dsize;
 +
 +		    if (size < ONE_MEG) {
 +			msgConfirm("The minimum slice size is 1MB");
 +			break;
 +		    }
 +
 +
  		    sprintf(tmp, "%d", SUBTYPE_FREEBSD);
  		    val = msgGetInput(tmp, "Enter type of partition to create:\n\n"
  			"Pressing Enter will choose the default, a native FreeBSD\n"
 @@ -920,7 +930,8 @@ diskPartitionNonInteractive(Device *dev)
  {
      char *cp;
      int i, all_disk = 0;
 -    daddr_t sz;
 +    daddr_t size;
 +    long double dsize;
  #ifdef PC98
      u_char *bootipl;
      size_t bootipl_size;
 @@ -964,7 +975,7 @@ diskPartitionNonInteractive(Device *dev)
  		/* If a chunk is at least 10MB in size, use it. */
  		if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
  		    Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size,
 -				 freebsd, 3,
 +				 freebsd, SUBTYPE_FREEBSD,
  				 (chunk_info[i]->flags & CHUNK_ALIGN),
  				 "FreeBSD");
  		    variable_set2(DISK_PARTITIONED, "yes", 0);
 @@ -988,16 +999,19 @@ diskPartitionNonInteractive(Device *dev)
  
  	    All_FreeBSD(d, all_disk = TRUE);
  	}
 -	else if ((sz = strtoimax(cp, &cp, 0))) {
 -	    /* Look for sz bytes free */
 +	else if ((dsize = strtold(cp, &cp))) {
  	    if (*cp && toupper(*cp) == 'M')
 -		sz *= ONE_MEG;
 +		size *= (daddr_t) (dsize * ONE_MEG);
  	    else if (*cp && toupper(*cp) == 'G')
 -		sz *= ONE_GIG;
 +		size = (daddr_t) (dsize * ONE_GIG);
 +	    else
 +		size = (daddr_t) dsize;
 +
 +	    /* Look for size bytes free */
  	    for (i = 0; chunk_info[i]; i++) {
  		/* If a chunk is at least sz MB, use it. */
 -		if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
 -		    Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
 +		if (chunk_info[i]->type == unused && chunk_info[i]->size >= size) {
 +		    Create_Chunk(d, chunk_info[i]->offset, size, freebsd, SUBTYPE_FREEBSD,
  				 (chunk_info[i]->flags & CHUNK_ALIGN),
  				 "FreeBSD");
  		    variable_set2(DISK_PARTITIONED, "yes", 0);
 @@ -1006,7 +1020,7 @@ diskPartitionNonInteractive(Device *dev)
  	    }
  	    if (!chunk_info[i]) {
  		    msgConfirm("Unable to find %jd free blocks on this disk!",
 -			(intmax_t)sz);
 +			(intmax_t)size);
  		return;
  	    }
  	}
 
 Modified: head/usr.sbin/sysinstall/label.c
 ==============================================================================
 --- head/usr.sbin/sysinstall/label.c	Wed Jun 16 15:09:45 2010	(r209234)
 +++ head/usr.sbin/sysinstall/label.c	Wed Jun 16 15:40:13 2010	(r209235)
 @@ -999,6 +999,7 @@ diskLabel(Device *dev)
  	    else {
  		char *val;
  		daddr_t size;
 +		long double dsize;
  		struct chunk *tmp;
  		char osize[80];
  		u_long flags = 0;
 @@ -1019,22 +1020,24 @@ diskLabel(Device *dev)
  #endif
  				  "%jd blocks (%jdMB) are free.",
  				  (intmax_t)sz, (intmax_t)sz / ONE_MEG);
 -		if (!val || (size = strtoimax(val, &cp, 0)) <= 0) {
 +		if (!val || (dsize = strtold(val, &cp)) <= 0) {
  		    clear_wins();
  		    break;
  		}
  
  		if (*cp) {
  		    if (toupper(*cp) == 'M')
 -			size *= ONE_MEG;
 +			size = (daddr_t) (dsize * ONE_MEG);
  		    else if (toupper(*cp) == 'G')
 -			size *= ONE_GIG;
 +			size = (daddr_t) (dsize * ONE_GIG);
  #ifndef __ia64__
  		    else if (toupper(*cp) == 'C')
 -			size *= (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect);
 +			size = (daddr_t) dsize * (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect);
  #endif
 +		    else
 +			size = (daddr_t) dsize;
  		}
 -		if (size <= FS_MIN_SIZE) {
 +		if (size < FS_MIN_SIZE) {
  		    msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG);
  		    clear_wins();
  		    break;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: brucec 
State-Changed-When: Wed Jun 16 15:51:57 UTC 2010 
State-Changed-Why:  
Fixed in HEAD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66350 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/66350: commit references a PR
Date: Sat,  7 Aug 2010 10:51:21 +0000 (UTC)

 Author: brucec
 Date: Sat Aug  7 10:51:01 2010
 New Revision: 211000
 URL: http://svn.freebsd.org/changeset/base/211000
 
 Log:
   MFC r209235, r210381 (bug fix for r209235):
   
   * Allow partial MB/GB values to be entered in the slice and label editors.
   * Don't strdup the name when calling deviceRegister because the string is
   copied within new_device.
   * Use a subtype of 165, not 3, when creating a slice in noninteractive
   mode.
   
   PR: bin/135333
   PR: bin/66350
   Approved by:	rrs (mentor)
 
 Modified:
   stable/8/usr.sbin/sysinstall/devices.c
   stable/8/usr.sbin/sysinstall/disks.c
   stable/8/usr.sbin/sysinstall/label.c
 Directory Properties:
   stable/8/usr.sbin/sysinstall/   (props changed)
 
 Modified: stable/8/usr.sbin/sysinstall/devices.c
 ==============================================================================
 --- stable/8/usr.sbin/sysinstall/devices.c	Sat Aug  7 10:23:54 2010	(r210999)
 +++ stable/8/usr.sbin/sysinstall/devices.c	Sat Aug  7 10:51:01 2010	(r211000)
 @@ -295,6 +295,8 @@ deviceGetAll(void)
  
      msgNotify("Probing devices, please wait (this can take a while)...");
      /* First go for the network interfaces.  Stolen shamelessly from ifconfig! */
 +    memset(&ifc, 0, sizeof(ifc));
 +    memset(buffer, 0, INTERFACE_MAX * sizeof(struct ifreq));
      ifc.ifc_len = sizeof(buffer);
      ifc.ifc_buf = buffer;
  
 @@ -371,7 +373,7 @@ skipif:
  
  		    if (fd >= 0) close(fd);
  		    snprintf(n, sizeof n, device_names[i].name, j);
 -		    deviceRegister(strdup(n), device_names[i].description, strdup(try),
 +		    deviceRegister(n, device_names[i].description, strdup(try),
  					 DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM,
  					 mediaShutdownCDROM, NULL);
  		    if (isDebug())
 @@ -390,7 +392,7 @@ skipif:
  
  		    close(fd);
  		    snprintf(n, sizeof n, device_names[i].name, j);
 -		    deviceRegister(strdup(n), device_names[i].description, strdup(try),
 +		    deviceRegister(n, device_names[i].description, strdup(try),
  				   DEVICE_TYPE_FLOPPY, TRUE, mediaInitFloppy, mediaGetFloppy,
  				   mediaShutdownFloppy, NULL);
  		    if (isDebug())
 @@ -405,7 +407,7 @@ skipif:
  
  			close(fd);
  			snprintf(n, sizeof(n), device_names[i].name, j);
 -			deviceRegister(strdup(n), device_names[i].description,
 +			deviceRegister(n, device_names[i].description,
  			    strdup(try), DEVICE_TYPE_USB, TRUE, mediaInitUSB,
  			    mediaGetUSB, mediaShutdownUSB, NULL);
  
 
 Modified: stable/8/usr.sbin/sysinstall/disks.c
 ==============================================================================
 --- stable/8/usr.sbin/sysinstall/disks.c	Sat Aug  7 10:23:54 2010	(r210999)
 +++ stable/8/usr.sbin/sysinstall/disks.c	Sat Aug  7 10:51:01 2010	(r211000)
 @@ -443,6 +443,7 @@ diskPartition(Device *dev)
  	    else {
  		char *val, tmp[20], name[16], *cp;
  		daddr_t size;
 +		long double dsize;
  		int subtype;
  		chunk_e partitiontype;
  #ifdef PC98
 @@ -457,11 +458,20 @@ diskPartition(Device *dev)
  		snprintf(tmp, 20, "%jd", (intmax_t)chunk_info[current_chunk]->size);
  		val = msgGetInput(tmp, "Please specify the size for new FreeBSD slice in blocks\n"
  				  "or append a trailing `M' for megabytes (e.g. 20M).");
 -		if (val && (size = strtoimax(val, &cp, 0)) > 0) {
 +		if (val && (dsize = strtold(val, &cp)) > 0 && dsize < UINT32_MAX) {
  		    if (*cp && toupper(*cp) == 'M')
 -			size *= ONE_MEG;
 +			size = (daddr_t) (dsize * ONE_MEG);
  		    else if (*cp && toupper(*cp) == 'G')
 -			size *= ONE_GIG;
 +			size = (daddr_t) (dsize * ONE_GIG);
 +		    else
 +			size = (daddr_t) dsize;
 +
 +		    if (size < ONE_MEG) {
 +			msgConfirm("The minimum slice size is 1MB");
 +			break;
 +		    }
 +
 +
  		    sprintf(tmp, "%d", SUBTYPE_FREEBSD);
  		    val = msgGetInput(tmp, "Enter type of partition to create:\n\n"
  			"Pressing Enter will choose the default, a native FreeBSD\n"
 @@ -915,7 +925,8 @@ diskPartitionNonInteractive(Device *dev)
  {
      char *cp;
      int i, all_disk = 0;
 -    daddr_t sz;
 +    daddr_t size;
 +    long double dsize;
  #ifdef PC98
      u_char *bootipl;
      size_t bootipl_size;
 @@ -959,7 +970,7 @@ diskPartitionNonInteractive(Device *dev)
  		/* If a chunk is at least 10MB in size, use it. */
  		if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
  		    Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size,
 -				 freebsd, 3,
 +				 freebsd, SUBTYPE_FREEBSD,
  				 (chunk_info[i]->flags & CHUNK_ALIGN),
  				 "FreeBSD");
  		    variable_set2(DISK_PARTITIONED, "yes", 0);
 @@ -983,16 +994,19 @@ diskPartitionNonInteractive(Device *dev)
  
  	    All_FreeBSD(d, all_disk = TRUE);
  	}
 -	else if ((sz = strtoimax(cp, &cp, 0))) {
 -	    /* Look for sz bytes free */
 +	else if ((dsize = strtold(cp, &cp))) {
  	    if (*cp && toupper(*cp) == 'M')
 -		sz *= ONE_MEG;
 +		size *= (daddr_t) (dsize * ONE_MEG);
  	    else if (*cp && toupper(*cp) == 'G')
 -		sz *= ONE_GIG;
 +		size = (daddr_t) (dsize * ONE_GIG);
 +	    else
 +		size = (daddr_t) dsize;
 +
 +	    /* Look for size bytes free */
  	    for (i = 0; chunk_info[i]; i++) {
  		/* If a chunk is at least sz MB, use it. */
 -		if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
 -		    Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
 +		if (chunk_info[i]->type == unused && chunk_info[i]->size >= size) {
 +		    Create_Chunk(d, chunk_info[i]->offset, size, freebsd, SUBTYPE_FREEBSD,
  				 (chunk_info[i]->flags & CHUNK_ALIGN),
  				 "FreeBSD");
  		    variable_set2(DISK_PARTITIONED, "yes", 0);
 @@ -1001,7 +1015,7 @@ diskPartitionNonInteractive(Device *dev)
  	    }
  	    if (!chunk_info[i]) {
  		    msgConfirm("Unable to find %jd free blocks on this disk!",
 -			(intmax_t)sz);
 +			(intmax_t)size);
  		return;
  	    }
  	}
 
 Modified: stable/8/usr.sbin/sysinstall/label.c
 ==============================================================================
 --- stable/8/usr.sbin/sysinstall/label.c	Sat Aug  7 10:23:54 2010	(r210999)
 +++ stable/8/usr.sbin/sysinstall/label.c	Sat Aug  7 10:51:01 2010	(r211000)
 @@ -999,6 +999,7 @@ diskLabel(Device *dev)
  	    else {
  		char *val;
  		daddr_t size;
 +		long double dsize;
  		struct chunk *tmp;
  		char osize[80];
  		u_long flags = 0;
 @@ -1019,22 +1020,27 @@ diskLabel(Device *dev)
  #endif
  				  "%jd blocks (%jdMB) are free.",
  				  (intmax_t)sz, (intmax_t)sz / ONE_MEG);
 -		if (!val || (size = strtoimax(val, &cp, 0)) <= 0) {
 +		if (!val || (dsize = strtold(val, &cp)) <= 0) {
  		    clear_wins();
  		    break;
  		}
  
  		if (*cp) {
  		    if (toupper(*cp) == 'M')
 -			size *= ONE_MEG;
 +			size = (daddr_t) (dsize * ONE_MEG);
  		    else if (toupper(*cp) == 'G')
 -			size *= ONE_GIG;
 +			size = (daddr_t) (dsize * ONE_GIG);
  #ifndef __ia64__
  		    else if (toupper(*cp) == 'C')
 -			size *= (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect);
 +			size = (daddr_t) dsize * (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect);
  #endif
 +		    else
 +			size = (daddr_t) dsize;
 +		} else {
 +			size = (daddr_t) dsize;
  		}
 -		if (size <= FS_MIN_SIZE) {
 +
 +		if (size < FS_MIN_SIZE) {
  		    msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG);
  		    clear_wins();
  		    break;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed  
State-Changed-By: brucec 
State-Changed-When: Sat Aug 7 11:17:23 UTC 2010 
State-Changed-Why:  
Fix has been merged to stable/7 and stable/8. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66350 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/66350: commit references a PR
Date: Sat,  7 Aug 2010 11:15:53 +0000 (UTC)

 Author: brucec
 Date: Sat Aug  7 11:15:32 2010
 New Revision: 211002
 URL: http://svn.freebsd.org/changeset/base/211002
 
 Log:
   MFC r209235, r210381 (bug fix for r209235):
   
   * Allow partial MB/GB values to be entered in the slice and label editor.
   * Don't strdup the name when calling deviceRegister because the string is
   copied within new_device.
   * Use a subtype of 165, not 3, when creating a slice in noninteractive
   mode.
   
   PR: bin/135333
   PR: bin/66350
   Approved by: rrs (mentor)
 
 Modified:
   stable/7/usr.sbin/sysinstall/devices.c
   stable/7/usr.sbin/sysinstall/disks.c
   stable/7/usr.sbin/sysinstall/label.c
 Directory Properties:
   stable/7/usr.sbin/sysinstall/   (props changed)
 
 Modified: stable/7/usr.sbin/sysinstall/devices.c
 ==============================================================================
 --- stable/7/usr.sbin/sysinstall/devices.c	Sat Aug  7 11:13:50 2010	(r211001)
 +++ stable/7/usr.sbin/sysinstall/devices.c	Sat Aug  7 11:15:32 2010	(r211002)
 @@ -281,6 +281,8 @@ deviceGetAll(void)
  
      msgNotify("Probing devices, please wait (this can take a while)...");
      /* First go for the network interfaces.  Stolen shamelessly from ifconfig! */
 +    memset(&ifc, 0, sizeof(ifc));
 +    memset(buffer, 0, INTERFACE_MAX * sizeof(struct ifreq));
      ifc.ifc_len = sizeof(buffer);
      ifc.ifc_buf = buffer;
  
 @@ -357,7 +359,7 @@ skipif:
  
  		    if (fd >= 0) close(fd);
  		    snprintf(n, sizeof n, device_names[i].name, j);
 -		    deviceRegister(strdup(n), device_names[i].description, strdup(try),
 +		    deviceRegister(n, device_names[i].description, strdup(try),
  					 DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM,
  					 mediaShutdownCDROM, NULL);
  		    if (isDebug())
 @@ -390,7 +392,7 @@ skipif:
  
  		    close(fd);
  		    snprintf(n, sizeof n, device_names[i].name, j);
 -		    deviceRegister(strdup(n), device_names[i].description, strdup(try),
 +		    deviceRegister(n, device_names[i].description, strdup(try),
  				   DEVICE_TYPE_FLOPPY, TRUE, mediaInitFloppy, mediaGetFloppy,
  				   mediaShutdownFloppy, NULL);
  		    if (isDebug())
 
 Modified: stable/7/usr.sbin/sysinstall/disks.c
 ==============================================================================
 --- stable/7/usr.sbin/sysinstall/disks.c	Sat Aug  7 11:13:50 2010	(r211001)
 +++ stable/7/usr.sbin/sysinstall/disks.c	Sat Aug  7 11:15:32 2010	(r211002)
 @@ -455,6 +455,7 @@ diskPartition(Device *dev)
  	    else {
  		char *val, tmp[20], name[16], *cp;
  		daddr_t size;
 +		long double dsize;
  		int subtype;
  		chunk_e partitiontype;
  #ifdef PC98
 @@ -469,11 +470,20 @@ diskPartition(Device *dev)
  		snprintf(tmp, 20, "%jd", (intmax_t)chunk_info[current_chunk]->size);
  		val = msgGetInput(tmp, "Please specify the size for new FreeBSD slice in blocks\n"
  				  "or append a trailing `M' for megabytes (e.g. 20M).");
 -		if (val && (size = strtoimax(val, &cp, 0)) > 0) {
 +		if (val && (dsize = strtold(val, &cp)) > 0 && dsize < UINT32_MAX) {
  		    if (*cp && toupper(*cp) == 'M')
 -			size *= ONE_MEG;
 +			size = (daddr_t) (dsize * ONE_MEG);
  		    else if (*cp && toupper(*cp) == 'G')
 -			size *= ONE_GIG;
 +			size = (daddr_t) (dsize * ONE_GIG);
 +		    else
 +			size = (daddr_t) dsize;
 +
 +		    if (size < ONE_MEG) {
 +			msgConfirm("The minimum slice size is 1MB");
 +			break;
 +		    }
 +
 +
  		    sprintf(tmp, "%d", SUBTYPE_FREEBSD);
  		    val = msgGetInput(tmp, "Enter type of partition to create:\n\n"
  			"Pressing Enter will choose the default, a native FreeBSD\n"
 @@ -927,7 +937,8 @@ diskPartitionNonInteractive(Device *dev)
  {
      char *cp;
      int i, all_disk = 0;
 -    daddr_t sz;
 +    daddr_t size;
 +    long double dsize;
  #ifdef PC98
      u_char *bootipl;
      size_t bootipl_size;
 @@ -971,7 +982,7 @@ diskPartitionNonInteractive(Device *dev)
  		/* If a chunk is at least 10MB in size, use it. */
  		if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
  		    Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size,
 -				 freebsd, 3,
 +				 freebsd, SUBTYPE_FREEBSD,
  				 (chunk_info[i]->flags & CHUNK_ALIGN),
  				 "FreeBSD");
  		    variable_set2(DISK_PARTITIONED, "yes", 0);
 @@ -995,16 +1006,19 @@ diskPartitionNonInteractive(Device *dev)
  
  	    All_FreeBSD(d, all_disk = TRUE);
  	}
 -	else if ((sz = strtoimax(cp, &cp, 0))) {
 -	    /* Look for sz bytes free */
 +	else if ((dsize = strtold(cp, &cp))) {
  	    if (*cp && toupper(*cp) == 'M')
 -		sz *= ONE_MEG;
 +		size *= (daddr_t) (dsize * ONE_MEG);
  	    else if (*cp && toupper(*cp) == 'G')
 -		sz *= ONE_GIG;
 +		size = (daddr_t) (dsize * ONE_GIG);
 +	    else
 +		size = (daddr_t) dsize;
 +
 +	    /* Look for size bytes free */
  	    for (i = 0; chunk_info[i]; i++) {
  		/* If a chunk is at least sz MB, use it. */
 -		if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
 -		    Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
 +		if (chunk_info[i]->type == unused && chunk_info[i]->size >= size) {
 +		    Create_Chunk(d, chunk_info[i]->offset, size, freebsd, SUBTYPE_FREEBSD,
  				 (chunk_info[i]->flags & CHUNK_ALIGN),
  				 "FreeBSD");
  		    variable_set2(DISK_PARTITIONED, "yes", 0);
 @@ -1013,7 +1027,7 @@ diskPartitionNonInteractive(Device *dev)
  	    }
  	    if (!chunk_info[i]) {
  		    msgConfirm("Unable to find %jd free blocks on this disk!",
 -			(intmax_t)sz);
 +			(intmax_t)size);
  		return;
  	    }
  	}
 
 Modified: stable/7/usr.sbin/sysinstall/label.c
 ==============================================================================
 --- stable/7/usr.sbin/sysinstall/label.c	Sat Aug  7 11:13:50 2010	(r211001)
 +++ stable/7/usr.sbin/sysinstall/label.c	Sat Aug  7 11:15:32 2010	(r211002)
 @@ -999,6 +999,7 @@ diskLabel(Device *dev)
  	    else {
  		char *val;
  		daddr_t size;
 +		long double dsize;
  		struct chunk *tmp;
  		char osize[80];
  		u_long flags = 0;
 @@ -1019,22 +1020,27 @@ diskLabel(Device *dev)
  #endif
  				  "%jd blocks (%jdMB) are free.",
  				  (intmax_t)sz, (intmax_t)sz / ONE_MEG);
 -		if (!val || (size = strtoimax(val, &cp, 0)) <= 0) {
 +		if (!val || (dsize = strtold(val, &cp)) <= 0) {
  		    clear_wins();
  		    break;
  		}
  
  		if (*cp) {
  		    if (toupper(*cp) == 'M')
 -			size *= ONE_MEG;
 +			size = (daddr_t) (dsize * ONE_MEG);
  		    else if (toupper(*cp) == 'G')
 -			size *= ONE_GIG;
 +			size = (daddr_t) (dsize * ONE_GIG);
  #ifndef __ia64__
  		    else if (toupper(*cp) == 'C')
 -			size *= (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect);
 +			size = (daddr_t) dsize * (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect);
  #endif
 +		    else
 +			size = (daddr_t) dsize;
 +		} else {
 +			size = (daddr_t) dsize;
  		}
 -		if (size <= FS_MIN_SIZE) {
 +
 +		if (size < FS_MIN_SIZE) {
  		    msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG);
  		    clear_wins();
  		    break;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
