[parted-devel] [PATCH 2/2] libparted: raised dos partition limit from 16 to 64

Jim Meyering jim at meyering.net
Thu Jan 19 13:50:01 UTC 2012


Jim Meyering wrote:
> Phillip Susi wrote:
...
> Thanks for another fine patch.
> I used this one as the impetus to fix the half-cooked
> addition I made to your previous patch.  There, I hard-coded
> the expected first partition dimensions with this line:
>
>    "1:$((start-2))s:$((start-2+4098-1))s:4098s:::lba;"
>
> That obviously has too many literals, so I have corrected it
> with this:
>
> diff --git a/tests/t9042-dos-partition-limit.sh b/tests/t9042-dos-partition-limit.sh
> index 7e3e84a..91d3311 100644
> --- a/tests/t9042-dos-partition-limit.sh
> +++ b/tests/t9042-dos-partition-limit.sh
> @@ -39,9 +39,10 @@ scsi_debug_setup_ sector_size=$ss dev_size_mb=$n_MiB > dev-name ||
>  scsi_dev=$(cat dev-name)
>
>  n=$((n_MiB * sectors_per_MiB))
> +len=$((2 + partition_sectors * (3+n_partitions)))
>  printf '%s\n' "BYT;" \
>      "$scsi_dev:${n}s:scsi:$ss:$ss:msdos:Linux scsi_debug;" \
> -    "1:$((start-2))s:$((start-2+4098-1))s:4098s:::lba;" \
> +    "1:$((start-2))s:$((start-2+len-1))s:${len}s:::lba;" \
>    > exp || fail=1
>
>  parted -s $scsi_dev mklabel msdos || fail=1
>
> But even that is still not right, since when I test with
> a simulated larger sector size,
>   sudo make -C tests check VERBOSE=yes TESTS=t9042-dos-partition-limit.sh \
>     PARTED_SECTOR_SIZE=4096
> it fails with this:
>
>   --- exp 2012-01-18 13:39:04.966226938 +0000
>   +++ out 2012-01-18 13:39:05.165232120 +0000
>   @@ -1,6 +1,6 @@
>    BYT;
>    /dev/sdd:17664s:scsi:4096:4096:msdos:Linux scsi_debug;
>   -1:2046s:18431s:16386s:::lba;
>   +1:2046s:17663s:15618s:::lba;
>
> Which means the "len=..." part must be changed to depend on $ss.
> If someone wants to correct the formula above, please let me know.
> Otherwise, I'll probably do it today or tomorrow.

When you see it, it's trivial.
Plus, I replaced your literal 2046 with $((start-2)).
With these folded in, "sudo make check" passes once again.

diff --git a/tests/t9042-dos-partition-limit.sh b/tests/t9042-dos-partition-limit.sh
index 91d3311..fe783c7 100644
--- a/tests/t9042-dos-partition-limit.sh
+++ b/tests/t9042-dos-partition-limit.sh
@@ -39,14 +39,13 @@ scsi_debug_setup_ sector_size=$ss dev_size_mb=$n_MiB > dev-name ||
 scsi_dev=$(cat dev-name)

 n=$((n_MiB * sectors_per_MiB))
-len=$((2 + partition_sectors * (3+n_partitions)))
 printf '%s\n' "BYT;" \
     "$scsi_dev:${n}s:scsi:$ss:$ss:msdos:Linux scsi_debug;" \
-    "1:$((start-2))s:$((start-2+len-1))s:${len}s:::lba;" \
+    "1:$((start-2))s:$((n-1))s:$((n-start+2))s:::lba;" \
   > exp || fail=1

 parted -s $scsi_dev mklabel msdos || fail=1
-parted -s -a min $scsi_dev mkpart extended 2046s 100% || fail=1
+parted -s -a min $scsi_dev mkpart extended $((start-2))s 100% || fail=1

 i=1
 while :; do



More information about the parted-devel mailing list