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

Jim Meyering meyering at alioth.debian.org
Mon Jun 11 16:49:32 UTC 2007


 tests/t2000-mkfs.sh |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit 2c4db612ed7de2a19554a6af617f59ecbd4ff1ca
Author: Jim Meyering <jim at meyering.net>
Date:   Mon Jun 11 14:34:39 2007 +0200

    Add a test to record the current EXT2 mkpartfs failure for some sizes.
    
    Run this:
    
        dev=F
        dd if=/dev/null of=$dev bs=1 seek=20M
        ./parted -s $dev mklabel gpt
        ./parted -s $dev mkpartfs primary ext2 0 16796160B
    
    It fails with this diagnostic:
    
        Error: Attempt to write sectors 32772-32773 outside of partition on /t/F.
    
    But if you choose a size that's one byte smaller, it works:
    
        ./parted -s $dev mkpartfs primary ext2 0 16796159B
    
    The difference is in how ext2_mkfs_write_meta computes
    the number of block groups.  In the former case, it computes
    numgroups = 3.  In the latter, numgroups = 2.
    The trouble with the first case is that there isn't enough
    space for 3 full block groups in a file system of that size.
    Hence the eventual attempt to write beyond the initially-
    established end-of-file-system mark.

diff --git a/tests/t2000-mkfs.sh b/tests/t2000-mkfs.sh
index 6178c52..66a66a3 100755
--- a/tests/t2000-mkfs.sh
+++ b/tests/t2000-mkfs.sh
@@ -106,4 +106,23 @@ test_expect_success \
        echo "Error: Expecting a file system type."; } > exp &&
      $compare out exp'
 
+#############################################################
+# Demonstrate 3-block-group failure for 16+MB EXT2 file system.
+# This test fails with at least parted-1.8.8.
+
+dev=loop-file
+
+test_expect_success \
+    "setup: create and label a device" \
+    'dd if=/dev/null of=$dev bs=1 seek=20M 2>/dev/null &&
+     parted -s $dev mklabel gpt'
+
+# FIXME: this test currently fails with the diagnostic "Error: Attempt
+# to write sectors 32772-32773 outside of partition on .../loop-file."
+# Eventually, when this bug is fixed, change to "test_expect_success"
+# and ensure that the output file is empty.
+test_expect_failure \
+    'try to create a file system with the offending size' \
+    'parted -s $dev mkpartfs primary ext2 0 16796160B >out 2>&1'
+
 test_done



More information about the Parted-commits mailing list