[parted-devel] [PATCH] libparted: uninit_bg and flex_bg features should indicate ext4

Jim Meyering jim at meyering.net
Tue Apr 13 17:50:08 UTC 2010


Colin Watson wrote:
> According to tune2fs(8), the uninit_bg and flex_bg features are only
> supported by ext4, so libparted should treat their presence as
> indicating ext4.  Reported by C de-Avillez in
> https://bugs.launchpad.net/ubuntu/+source/parted/+bug/561599.
>
> * libparted/fs/ext2/ext2_fs.h: Define EXT4_FEATURE_RO_COMPAT_GDT_CSUM
> and EXT4_FEATURE_INCOMPAT_FLEX_BG.
> * libparted/fs/ext2/interface.c (_ext2_generic_probe): Test for
> EXT4_FEATURE_RO_COMPAT_GDT_CSUM and EXT4_FEATURE_INCOMPAT_FLEX_BG when
> probing for ext4.
> * tests/t1700-ext-probe.sh: Test for this.

Thanks!  This looks great.
I've applied it with some small changes.
  - added this in NEWS:

      libparted uses a more accurate heuristic to distinguish between
      ext4 and ext3 partitions.

  - squashed in the patch below, to:
    * fix typo s/2>1/2>&1/
    * make false-positive test for "ext4" less likely:
      a) parted's -m option gives more parseable output
      b) test for more explicit regexp that should not match, say,
          the absolute device name that "parted ...print" prints

> diff --git a/tests/t1700-ext-probe.sh b/tests/t1700-ext-probe.sh
...
> +# Some features should indicate ext4 by themselves.
> +for feature in uninit_bg flex_bg; do
> +  # create an ext3 file system
> +  dd if=/dev/zero of=$dev bs=1024 count=4096 >/dev/null || fail=1
> +  mkfs.ext3 -F $dev >/dev/null || fail=1
> +
> +  # set the feature
> +  tune2fs -O $feature $dev || fail=1
> +
> +  # probe the file system, which should now be ext4
> +  parted -s $dev print >out 2>1 || fail=1
> +  grep -w ext4 out || fail=1
> +done
> +
>  Exit $fail

diff --git a/tests/t1700-ext-probe.sh b/tests/t1700-ext-probe.sh
index 726ba27..62ca8e5 100755
--- a/tests/t1700-ext-probe.sh
+++ b/tests/t1700-ext-probe.sh
@@ -55,8 +55,8 @@ for feature in uninit_bg flex_bg; do
   tune2fs -O $feature $dev || fail=1

   # probe the file system, which should now be ext4
-  parted -s $dev print >out 2>1 || fail=1
-  grep -w ext4 out || fail=1
+  parted -m -s $dev u s print >out 2>&1 || fail=1
+  grep '^1:.*:ext4::;$' out || fail=1
 done

 Exit $fail

Here's the result I'll push soon:



More information about the parted-devel mailing list