From nobody@FreeBSD.org  Sun Aug 14 12:55:07 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 068F7106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 14 Aug 2011 12:55:06 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id C83938FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 14 Aug 2011 12:55:06 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p7ECt6aw032993
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 14 Aug 2011 12:55:06 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p7ECt6AA032987;
	Sun, 14 Aug 2011 12:55:06 GMT
	(envelope-from nobody)
Message-Id: <201108141255.p7ECt6AA032987@red.freebsd.org>
Date: Sun, 14 Aug 2011 12:55:06 GMT
From: Hyogeol Lee <hyogeollee@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: fdisk(8) cannot set active partition using '-u' option
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         159765
>Category:       bin
>Synopsis:       fdisk(8) cannot set active partition using '-u' option
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 14 13:00:20 UTC 2011
>Closed-Date:    Fri Aug 19 12:49:27 UTC 2011
>Last-Modified:  Fri Aug 19 12:50:09 UTC 2011
>Originator:     Hyogeol Lee
>Release:        FreeBSD 9.0-current
>Organization:
BTS technologies
>Environment:
FreeBSD darkstar 9.0-BETA1 FreeBSD 9.0-BETA1 #0: Sat Aug  6 02:51:38 KST 2011     root@darkstar:/usr/obj/usr/src/sys/QUEEN  amd64
>Description:
I have failed to set active partition using '-u' option of fdisk(8) on 9.0-current.

The error message was "Active partition number must be in range 1-4.  Try again.".

This is full message while fdisk:


******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=10443 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=10443 heads=255 sectors/track=63 (16065 blks/cyl)

Do you want to change our idea of what BIOS thinks ? [n] 
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 238 (0xee),(EFI GPT)
    start 1, size 167772159 (81919 Meg), flag 80 (active)
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 1023/ head 255/ sector 63
Do you want to change it? [n] 
The data for partition 2 is:
<UNUSED>
Do you want to change it? [n] 
The data for partition 3 is:
<UNUSED>
Do you want to change it? [n] 
The data for partition 4 is:
<UNUSED>
Do you want to change it? [n] 
Partition 1 is marked active
Do you want to change the active partition? [n] y
Supply a decimal value for "active partition" [1] 1
Active partition number must be in range 1-4.  Try again.
Supply a decimal value for "active partition" [1] 2
Active partition number must be in range 1-4.  Try again.
Supply a decimal value for "active partition" [1] 3
Active partition number must be in range 1-4.  Try again.
Supply a decimal value for "active partition" [1] 4
Active partition number must be in range 1-4.  Try again.
Supply a decimal value for "active partition" [1]
>How-To-Repeat:
'fdisk -u' to your disk and try to set active partition

>Fix:


>Release-Note:
>Audit-Trail:

From: "Andrey V. Elsukov" <ae@FreeBSD.org>
To: Hyogeol Lee <hyogeollee@gmail.com>
Cc: freebsd-gnats-submit@FreeBSD.org, sobomax@freebsd.org
Subject: Re: bin/159765: fdisk(8) cannot set active partition using '-u' option
Date: Mon, 15 Aug 2011 21:25:54 +0400

 On 14.08.2011 16:55, Hyogeol Lee wrote:
 > FreeBSD darkstar 9.0-BETA1 FreeBSD 9.0-BETA1 #0: Sat Aug  6 02:51:38 KST 2011     root@darkstar:/usr/obj/usr/src/sys/QUEEN  amd64
 >> Description:
 > I have failed to set active partition using '-u' option of fdisk(8) on 9.0-current.
 > 
 > The error message was "Active partition number must be in range 1-4.  Try again.".
 > 
 >> How-To-Repeat:
 > 'fdisk -u' to your disk and try to set active partition
 > 
 
 It seems there is a bug in decimal() function introduced in r217808.
 But you can change active attribute with gpart(8).
 
 -- 
 WBR, Andrey V. Elsukov
State-Changed-From-To: open->closed 
State-Changed-By: ae 
State-Changed-When: Fri Aug 19 12:48:36 UTC 2011 
State-Changed-Why:  
Fixed in r225007. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/159765: commit references a PR
Date: Fri, 19 Aug 2011 12:48:20 +0000 (UTC)

 Author: ae
 Date: Fri Aug 19 12:48:06 2011
 New Revision: 225007
 URL: http://svn.freebsd.org/changeset/base/225007
 
 Log:
   The decimal() function was changed in r217808 to take the
   maximum value instead of number of bits. But for case when
   limitation is not needed it erroneously skips conversion to
   number and always returns zero. So, don't skip conversion
   for case when limitation is not needed.
   
   PR:		bin/159765
   Approved by:	re (kib)
 
 Modified:
   head/sbin/fdisk/fdisk.c
 
 Modified: head/sbin/fdisk/fdisk.c
 ==============================================================================
 --- head/sbin/fdisk/fdisk.c	Fri Aug 19 12:08:54 2011	(r225006)
 +++ head/sbin/fdisk/fdisk.c	Fri Aug 19 12:48:06 2011	(r225007)
 @@ -940,7 +940,7 @@ decimal(const char *str, int *num, int d
  			return 0;
  		while ((c = *cp++)) {
  			if (c <= '9' && c >= '0') {
 -				if (maxval > 0 && acc <= maxval)
 +				if (acc <= maxval || maxval == 0)
  					acc = acc * 10 + c - '0';
  			} else
  				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:
