From owner-freebsd-ia64@FreeBSD.ORG Sun Jun 27 07:19:44 2004 Return-Path: Delivered-To: freebsd-ia64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 64A4616A4CE for ; Sun, 27 Jun 2004 07:19:44 +0000 (GMT) Received: from eagle.sharma-home.net (cpe-24-221-178-208.ca.sprintbbd.net [24.221.178.208]) by mx1.FreeBSD.org (Postfix) with ESMTP id 382DB43D3F for ; Sun, 27 Jun 2004 07:19:44 +0000 (GMT) (envelope-from adsharma@eagle.sharma-home.net) Received: by eagle.sharma-home.net (Postfix, from userid 500) id E98761FF39; Sun, 27 Jun 2004 00:19:31 -0700 (PDT) Date: Sun, 27 Jun 2004 00:19:31 -0700 From: Arun Sharma To: freebsd-ia64@freebsd.org Message-ID: <20040627071931.GA25902@sharma-home.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="HlL+5n6rz5pIUxbD" Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: Clobbering foreign partitions X-BeenThere: freebsd-ia64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the IA-64 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2004 07:19:44 -0000 --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline libdisk seems to have a bug which causes it to corrupt the GPT table in the presence of foreign partitions. Description: Consider a GPT with the following partitions: - EFI system (da0p1) - Linux (da0p2) When libdisk opens the disk and creates a list of chunks, it ignores da0p2, because it's an "unknown" type. In other words, there is only one chunk. The rest is "unused". Subsequently, sysinstall doesn't display da0p2 (which I think is ok), but allows the user to create a FreeBSD partition on da0p2. I think the intended behavior is to ignore foreign partitions in sysinstall UI, but take care not to clobber them in Write_Disk(). The attached patch changes the policy on ia64 only and correctly handles the above situation. -Arun --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="libdisk-ia64-policy.patch" Index: chunk.c =================================================================== RCS file: /net/eagle/home/scratch/freebsd/src/lib/libdisk/chunk.c,v retrieving revision 1.51 diff -u -r1.51 chunk.c --- chunk.c 21 Apr 2004 23:21:13 -0000 1.51 +++ chunk.c 27 Jun 2004 07:00:29 -0000 @@ -272,6 +272,7 @@ case fat: case efi: case mbr: + default: c1 = Find_Mother_Chunk(d->chunks, offset, end, whole); break; case part: @@ -281,8 +282,6 @@ c1 = Find_Mother_Chunk(d->chunks, offset, end, whole); break; - default: - return (-1); } break; case p_pc98: --HlL+5n6rz5pIUxbD--