[Parted-maintainers] Bug#706023: parted: mkpart screws up value if start is 1 plus a unit

Phillip Susi psusi at ubuntu.com
Tue Apr 23 20:15:41 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 4/23/2013 11:11 AM, Len Sorensen wrote:
> Package: parted Version: 2.3-12 Severity: normal Tags: upstream
> 
> If you try to create a partition starting at 1MiB and ending at the
> end of the disk by doing:
> 
> mkpart primary 1MiB -1s
> 
> You can a warning about alignment (which is obviously wrong given
> 1MiB is perfectly aligned), and the start is instead 63s.

It looks like this was fixed upstream in commit 18e727d4 - libparted:
fix snap radius so that it is using half, which is a simple one line
change:

diff --git a/libparted/unit.c b/libparted/unit.c
index dc4205b..c2921e3 100644
- --- a/libparted/unit.c
+++ b/libparted/unit.c
@@ -533,7 +533,7 @@ ped_unit_parse_custom (const char* str, const
PedDevice* dev, PedUnit unit,
        }

        unit_size = ped_unit_get_size (dev, unit);
- -       radius = ped_div_round_up (unit_size, dev->sector_size) - 1;
+       radius = (ped_div_round_up (unit_size, dev->sector_size) / 2) - 1;
        if (radius < 0)
                radius = 0;
        /* If the user specifies units in a power of 2, e.g., 4MiB, as in


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRduvqAAoJEJrBOlT6nu75D78IANWiNm4jz4CnijILuAKO3wxD
ZtNhTQy8YZk1JzJ9I7L/TDtxp9tg8H591VyB7j23Q7svPwZoiFqa+RkVpH1lBoMS
I6ks8SAipiq7AkgzHBaJKHmpXscgez38ujYdHXArywLaCalrY5CnCs3Nwb1DT6Oc
E7G9N28y4cX6ifmyptCdav0dRAs1l2dVZRehhJKy6AQpc8Ggg4H40/2Bc+wXHtp3
OrAXH/Jsw65/jFVHyVtGhYnRcazazcN+9oQbV6G3GCNzNAbihQTKPnuwyICmnnrt
EWZJw8YVZu3kx2UbQrm7eC1pg/CkTUi7522MNO57HKQm2Upwbi+eh7fbPPLOx2I=
=oleD
-----END PGP SIGNATURE-----



More information about the Parted-maintainers mailing list