[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Sun Feb 26 17:44:52 UTC 2012


 NEWS                   |    3 +++
 libparted/labels/mac.c |    3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 4559c510f02a691d90329fd646e8eefe2e73e6d2
Author: Jim Meyering <meyering at redhat.com>
Date:   Sun Feb 26 18:04:37 2012 +0100

    libparted: avoid unwarranted failed assertion during mklabel
    
    This could happen when running "parted -s $dev mklabel $type" for
    nearly any $type, assuming the underlying disk's sector size is
    larger than 512 bytes.  This particular failure was noticed by
    running tests/t9050-partition-table-types.sh with a simulated
    sector size of 1024, as is done as part of a top-level "make check",
    but so far, this failure has shown up only on RHEL-6.2.
    That test attempts to exercise an ugly part of partition table
    creation: during creation, parted checks for an existing
    partition table by iterating through its list of known types and
    attempting to read the disk, looking for a preexisting table.
    Knowing this, the test takes all pairs of partition table types,
    <A,B> and first creates a type of type A, and then creates on top
    of that (erasing the original) a table of type B.
    * libparted/labels/mac.c (_disk_analyse_ghost_size): Remove bogus
    assertion.  If the number of the sector with a matching signature
    is too large, simply reject it by returning 0.
    * NEWS (Bug fixes): Mention this.

diff --git a/NEWS b/NEWS
index fc93e98..50d9126 100644
--- a/NEWS
+++ b/NEWS
@@ -71,6 +71,9 @@ GNU parted NEWS                                    -*- outline -*-
   of partitions the device can hold.  With this change, parted now correctly
   informs kernel about new partitions on partitionable MD RAID devices.
 
+  libparted: creating a new partition table on a device with an existing
+  mac partition table could result in a failed assertion.
+
 ** Changes in behavior
 
   Floppy drives are no longer scanned on linux: they cannot be partitioned
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
index 41ea398..1f59a1a 100644
--- a/libparted/labels/mac.c
+++ b/libparted/labels/mac.c
@@ -704,8 +704,7 @@ _disk_analyse_ghost_size (PedDisk* disk)
 		if (_rawpart_check_signature (buf)
 		    && !_rawpart_is_void (buf)) {
 			mac_disk_data->ghost_size = i;
-			PED_ASSERT (i <= disk->dev->sector_size / 512);
-			found = 1;
+			found = (i <= disk->dev->sector_size / 512);
 			break;
 		}
 	}



More information about the Parted-commits mailing list