Patchwork libparted: make sure not to treat percentages as exact

login
register
mail settings
Submitter yanjun.zhu
Date March 12, 2014, 9:46 a.m.
Message ID <1394617589-29064-1-git-send-email-yanjun.zhu@windriver.com>
Download mbox | patch
Permalink /patch/68493/
State New
Headers show

Comments

yanjun.zhu - March 12, 2014, 9:46 a.m.
---
 ...ke-sure-not-to-treat-percentages-as-exact.patch |   22 ++++++++++++++++++++
 meta/recipes-extended/parted/parted_3.1.bb         |    3 ++-
 2 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/parted/parted-3.1/parted-libparted-make-sure-not-to-treat-percentages-as-exact.patch
Richard Purdie - March 12, 2014, 1:14 p.m.
On Wed, 2014-03-12 at 17:46 +0800, Zhu Yanjun wrote:
> ---
>  ...ke-sure-not-to-treat-percentages-as-exact.patch |   22 ++++++++++++++++++++
>  meta/recipes-extended/parted/parted_3.1.bb         |    3 ++-
>  2 files changed, 24 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-extended/parted/parted-3.1/parted-libparted-make-sure-not-to-treat-percentages-as-exact.patch

There is no long log in the commit message (why is this patch
important?) and no Upstream-Status in the patch.

Cheers,

Richard
Otavio Salvador - March 13, 2014, 1:53 a.m.
On Wed, Mar 12, 2014 at 10:14 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Wed, 2014-03-12 at 17:46 +0800, Zhu Yanjun wrote:
>> ---
>>  ...ke-sure-not-to-treat-percentages-as-exact.patch |   22 ++++++++++++++++++++
>>  meta/recipes-extended/parted/parted_3.1.bb         |    3 ++-
>>  2 files changed, 24 insertions(+), 1 deletion(-)
>>  create mode 100644 meta/recipes-extended/parted/parted-3.1/parted-libparted-make-sure-not-to-treat-percentages-as-exact.patch
>
> There is no long log in the commit message (why is this patch
> important?) and no Upstream-Status in the patch.

Please send the patch to the upstream mailing list. I can help with
the handling there if needed (I was quite involved in GNU Parted
development, in past).

Patch

diff --git a/meta/recipes-extended/parted/parted-3.1/parted-libparted-make-sure-not-to-treat-percentages-as-exact.patch b/meta/recipes-extended/parted/parted-3.1/parted-libparted-make-sure-not-to-treat-percentages-as-exact.patch
new file mode 100644
index 0000000..1cf8309
--- /dev/null
+++ b/meta/recipes-extended/parted/parted-3.1/parted-libparted-make-sure-not-to-treat-percentages-as-exact.patch
@@ -0,0 +1,22 @@ 
+libparted: make sure not to treat percentages as exact
+
+If 1% of the drive size worked out ot be an even power of
+two, it would trigger the exact placement.  Add an exception
+for the percent units.
+---
+ libparted/unit.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libparted/unit.c b/libparted/unit.c
+index e545985..ff479f1 100644
+--- a/libparted/unit.c
++++ b/libparted/unit.c
+@@ -548,7 +548,7 @@ ped_unit_parse_custom (const char* str, const PedDevice* dev, PedUnit unit,
+ 	   do not use 4MiB as the range.  Rather, presume that they
+ 	   are specifying precisely the starting or ending number,
+ 	   and treat "4MiB" just as we would treat "4194304B".  */
+-	if (is_power_of_2 (unit_size))
++	if (is_power_of_2 (unit_size) && unit != PED_UNIT_PERCENT)
+ 		radius = 0;
+ 
+ 	*sector = num * unit_size / dev->sector_size;
diff --git a/meta/recipes-extended/parted/parted_3.1.bb b/meta/recipes-extended/parted/parted_3.1.bb
index 8344ea8..d791275 100644
--- a/meta/recipes-extended/parted/parted_3.1.bb
+++ b/meta/recipes-extended/parted/parted_3.1.bb
@@ -4,7 +4,7 @@  LICENSE = "GPLv3+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=2f31b266d3440dd7ee50f92cf67d8e6c"
 SECTION = "console/tools"
 DEPENDS = "ncurses readline util-linux"
-PR = "r1"
+PR = "r2"
 
 SRC_URI = "${GNU_MIRROR}/parted/parted-${PV}.tar.xz \
            file://no_check.patch \
@@ -15,6 +15,7 @@  SRC_URI = "${GNU_MIRROR}/parted/parted-${PV}.tar.xz \
            file://fix-deprecated-readline.patch \
            file://run-ptest \
            file://Makefile \
+           file://parted-libparted-make-sure-not-to-treat-percentages-as-exact.patch \
 "
 
 SRC_URI[md5sum] = "5d89d64d94bcfefa9ce8f59f4b81bdcb"