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

Jim Meyering meyering at alioth.debian.org
Wed Sep 12 19:03:23 UTC 2012


 libparted/labels/gpt.c   |    4 ++--
 tests/t7000-scripting.sh |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 48f236f9cf1bbcd4c9cc29ebaecee7ed189580e3
Author: Jim Meyering <meyering at redhat.com>
Date:   Wed Sep 12 10:01:53 2012 +0200

    gpt: permit "mklabel gpt" on a 67-sector device
    
    * libparted/labels/gpt.c (gpt_alloc): Correct checks in order to
    allow creation of a GPT partition table on a 67-sector device.
    The computation of the "data_end" sector number was one too low.
    Whereas there are two sectors at the beginning of the disk (pMBR
    and the GPT header sector), there is only one at the end: the
    backup GPT header.  That (67) is the size of the smallest GPT
    partition table, allowing for *no* partition table sectors.

diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 83e518f..564a889 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -501,11 +501,11 @@ gpt_alloc (const PedDevice *dev)
     goto error;
 
   data_start = 2 + GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size;
-  data_end = dev->length - 2
+  data_end = dev->length - 1
     - GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size;
 
   /* If the device is too small to have room for data, reject it.  */
-  if (data_end <= data_start)
+  if (data_end < data_start)
     goto error_free_disk;
 
   disk->disk_specific = gpt_disk_data = ped_malloc (sizeof (GPTDiskData));

commit 81faa9b3b957781871ec3ef0df6e357388f857a1
Author: Jim Meyering <meyering at redhat.com>
Date:   Wed Sep 12 20:34:48 2012 +0200

    tests: update t7000-scripting.sh to avoid new FP
    
    * tests/t7000-scripting.sh: Use -34s as the endpoint, not -1s,
    to avoid a spurious difference.  Also, remove quoting artifacts.

diff --git a/tests/t7000-scripting.sh b/tests/t7000-scripting.sh
index e64814b..859acda 100755
--- a/tests/t7000-scripting.sh
+++ b/tests/t7000-scripting.sh
@@ -47,7 +47,7 @@ for mkpart in mkpart; do
   dd if=/dev/zero of=testfile bs=${ss}c count=$N 2> /dev/null || fail=1
 
   # Test the scripting mode of $mkpart.
-  parted -s testfile -- mklabel gpt "$mkpart" p-name ext3 1s -1s > out 2>&1
+  parted -s testfile -- mklabel gpt "$mkpart" p-name ext3 1s -34s > out 2>&1
   test $? = 1 || fail=1
 
   # Compare the real error and the expected one
@@ -60,8 +60,8 @@ for mkpart in mkpart; do
   dd if=/dev/zero of=testfile bs=${ss}c count=$N 2> /dev/null || fail=1
   # Test the interactive mode of $mkpart
   echo n | \
-    parted ---pretend-input-tty testfile \
-      "mklabel gpt '$mkpart' p-name ext3 1s -1s" > out 2>&1 && fail=1
+    parted ---pretend-input-tty -- testfile \
+      mklabel gpt $mkpart p-name ext3 1s -34s > out 2>&1 && fail=1
 
   # We have to format the output before comparing.
   # normalize the actual output



More information about the Parted-commits mailing list