Bug#706023: parted: mkpart screws up value if start is 1 plus a unit

2013-04-25 Thread Len Sorensen
On Tue, Apr 23, 2013 at 04:15:41PM -0400, Phillip Susi wrote:
 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
 
 

And what are the chances of that patch making it into Debian any time
soon?  It sure wasted a lot of time wondering why it kept creating
partions wrong.  What a strange bug this was.

Hopefully the installer can get updated to handle something newer than
parted 2.3 for the next release after wheezy.

-- 
Len Sorensen


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#706023: parted: mkpart screws up value if start is 1 plus a unit

2013-04-23 Thread Len Sorensen
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.


If you do:

mkpart primary 2MiB -1s

you get exactly what you asked for, and the start is sector 4096 (512byte
sectors of course).


If you do:

mkpart primary 1MiB -1Mib

you get exactly what you asked for and the start is sector 2048.


mkpart primary 2048s -1s

also does what you ask for.


mkpart primary 1024KiB -1s

also works perfectly.


It seems that if you use different units for the two values, and the
first value is 1, then it does something messed up.

Using 1.0MiB doesn't change the behaviour, it is still broken.

-- 
Len Sorensen

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
powerpc

Kernel: Linux 3.8-trunk-amd64 (SMP w/1 CPU core)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages parted depends on:
ii  libblkid1   2.20.1-5.3
ii  libc6   2.17-0experimental2
ii  libdevmapper1.02.1  2:1.02.77-1
ii  libparted0debian1   2.3-12
ii  libreadline66.2+dfsg-0.1
ii  libtinfo5   5.9-10
ii  libuuid12.20.1-5.3

parted recommends no packages.

Versions of packages parted suggests:
pn  parted-doc  none

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#706023: parted: mkpart screws up value if start is 1 plus a unit

2013-04-23 Thread Phillip Susi
-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-


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org