diff --git a/parted-2.2-blkoflow-rh585159.patch b/parted-2.2-blkoflow-rh585159.patch new file mode 100644 index 0000000..a6031de --- /dev/null +++ b/parted-2.2-blkoflow-rh585159.patch @@ -0,0 +1,25 @@ +diff -up parted-1.8.1/libparted/fs/ext2/parted_io.c.blkoflow parted-1.8.1/libparted/fs/ext2/parted_io.c +--- parted-1.8.1/libparted/fs/ext2/parted_io.c.blkoflow 2006-12-03 22:27:47.000000000 +0000 ++++ parted-1.8.1/libparted/fs/ext2/parted_io.c 2010-04-20 15:55:06.000000000 +0100 +@@ -82,7 +82,9 @@ static int do_read(void *cookie, void *p + { + struct my_cookie *monster = cookie; + +- return ped_geometry_read(monster->geom, ptr, block << (monster->logsize - 9), num << (monster->logsize - 9)); ++ return ped_geometry_read(monster->geom, ptr, ++ (PedSector)block << (monster->logsize - 9), ++ (PedSector)num << (monster->logsize - 9)); + } + + static int do_set_blocksize(void *cookie, int logsize) +@@ -98,8 +100,8 @@ static int do_write(void *cookie, void * + struct my_cookie *monster = cookie; + + return ped_geometry_write(monster->geom, ptr, +- block << (monster->logsize - 9), +- num << (monster->logsize - 9)); ++ (PedSector)block << (monster->logsize - 9), ++ (PedSector)num << (monster->logsize - 9)); + } + + diff --git a/parted-2.2-dm_task_run-retcode-rh585158.patch b/parted-2.2-dm_task_run-retcode-rh585158.patch new file mode 100644 index 0000000..3eb2808 --- /dev/null +++ b/parted-2.2-dm_task_run-retcode-rh585158.patch @@ -0,0 +1,91 @@ +From e20825c9f78c1ef69b71e574c46e3833b16b8e08 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 23 Apr 2010 12:13:53 +0200 +Subject: [PATCH parted] linux: dm_task_run returns 0 on error + +We were checking for a return value of < 0 for dm_task_run errors, but +dm_task_run returns 0 on error (and 1 on success). Thanks to Joe Jin +for spotting this, see Red Hat bug 582907. + +* libparted/arch/linux.c(_dm_remove_map_name, _dm_is_part, +_dm_remove_parts, _dm_add_partition): dm_task_run returns 0 on error. +--- + libparted/arch/linux.c | 19 +++++-------------- + 1 files changed, 5 insertions(+), 14 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 85cf813..d7ec2e4 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -2321,7 +2321,7 @@ _dm_remove_map_name(char *name) + rc = dm_task_run(task); + dm_task_update_nodes(); + dm_task_destroy(task); +- if (rc < 0) ++ if (!rc) + return 1; + + return 0; +@@ -2341,12 +2341,8 @@ _dm_is_part (struct dm_info *this, char *name) + return 0; + + dm_task_set_name(task, name); +- rc = dm_task_run(task); +- if (rc < 0) { +- rc = 0; ++ if (!dm_task_run(task)) + goto err; +- } +- rc = 0; + + memset(info, '\0', sizeof *info); + dm_task_get_info(task, info); +@@ -2357,7 +2353,6 @@ _dm_is_part (struct dm_info *this, char *name) + if (!deps) + goto err; + +- rc = 0; + for (i = 0; i < deps->count; i++) { + unsigned int ma = major(deps->device[i]), + mi = minor(deps->device[i]); +@@ -2389,8 +2384,7 @@ _dm_remove_parts (PedDevice* dev) + arch_specific->minor, 0)) + goto err; + +- rc = dm_task_run(task); +- if (rc < 0) ++ if (!dm_task_run(task)) + goto err; + + memset(info, '\0', sizeof *info); +@@ -2432,7 +2426,6 @@ err: + static int + _dm_add_partition (PedDisk* disk, PedPartition* part) + { +- int rc; + char* vol_name = NULL; + const char* dev_name = NULL; + char* params = NULL; +@@ -2450,8 +2443,7 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + arch_specific->minor, 0)) + goto err; + +- rc = dm_task_run(task); +- if (rc < 0) ++ if (!dm_task_run(task)) + goto err; + + dev_name = dm_task_get_name (task); +@@ -2474,8 +2466,7 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + dm_task_set_name (task, vol_name); + dm_task_add_target (task, 0, part->geom.length, + "linear", params); +- rc = dm_task_run (task); +- if (rc >= 0) { ++ if (dm_task_run (task)) { + //printf("0 %ld linear %s\n", part->geom.length, params); + dm_task_update_nodes(); + dm_task_destroy(task); +-- +1.7.0.1 + diff --git a/parted.spec b/parted.spec index f604547..f971ff9 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 2.2 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv3+ Group: Applications/System URL: http://www.gnu.org/software/parted @@ -17,6 +17,10 @@ Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz Patch0: parted-dev-mapper-symlink-rh577824.patch # Add a partition flag for detecting diagnostics / recovery partitions Patch1: parted-2.2-add-diag-flag-rh583626.patch +# Properly check dm_task_run return codes +Patch2: parted-2.2-dm_task_run-retcode-rh585158.patch +# Fix mkpartfs (ext2) on partition >2TB +Patch3: parted-2.2-blkoflow-rh585159.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: e2fsprogs-devel @@ -58,6 +62,8 @@ Parted library, you need to install this package. %setup -q %patch0 -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS @@ -133,6 +139,10 @@ fi %changelog +* Fri Apr 23 2010 Hans de Goede 2.2-4 +- Properly check dm_task_run return value (#585158) +- Fix mkpartfs (ext2) on partitions >2TB (#585159) + * Mon Apr 19 2010 Hans de Goede 2.2-3 - Add a flag for detecting diagnostics / recovery partitions (#583626)