- New upstream version 2.2 (#577478)
- Drop all our patches (all upstreamed)
This commit is contained in:
parent
febb3b2fab
commit
740a497422
@ -1 +1 @@
|
||||
parted-2.1.tar.xz
|
||||
parted-2.2.tar.xz
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 503c54ef274a923dcac337361936062b37a0ac1a Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Mon, 11 Jan 2010 11:46:36 +0100
|
||||
Subject: [PATCH parted 1/3] linux: use blkid_topology_get_physical_sector_size
|
||||
|
||||
The official 2.17 release of util-linux-ng, has added a function to
|
||||
get the physical sector size, use that instead of getting the
|
||||
minimum io size.
|
||||
* libparted/arch/linux.c(_device_set_sector_size): use
|
||||
blkid_topology_get_physical_sector_size.
|
||||
---
|
||||
libparted/arch/linux.c | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
||||
index aefe788..bf33059 100644
|
||||
--- a/libparted/arch/linux.c
|
||||
+++ b/libparted/arch/linux.c
|
||||
@@ -668,7 +668,7 @@ _device_set_sector_size (PedDevice* dev)
|
||||
dev->path, strerror (errno), PED_SECTOR_SIZE_DEFAULT);
|
||||
} else {
|
||||
dev->phys_sector_size =
|
||||
- blkid_topology_get_minimum_io_size(
|
||||
+ blkid_topology_get_physical_sector_size(
|
||||
arch_specific->topology);
|
||||
}
|
||||
#endif
|
||||
--
|
||||
1.6.5.2
|
||||
|
@ -1,26 +0,0 @@
|
||||
From 122bc980e27334d0f6243b74fffc8d2cefe0eb5c Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 10 Feb 2010 14:11:14 +0100
|
||||
Subject: [PATCH parted] dasd: Fix NULL pointer dereference in dasd_read
|
||||
|
||||
* libparted/labels/dasd.c (dasd_read): Fix NULL ptr dereference.
|
||||
---
|
||||
libparted/labels/dasd.c | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
|
||||
index 4b5840b..516d189 100644
|
||||
--- a/libparted/labels/dasd.c
|
||||
+++ b/libparted/labels/dasd.c
|
||||
@@ -399,7 +399,7 @@ dasd_read (PedDisk* disk)
|
||||
|
||||
if (strncmp(PART_TYPE_SWAP, str, 6) == 0) {
|
||||
fs = ped_file_system_probe(&part->geom);
|
||||
- if (is_linux_swap(fs->name)) {
|
||||
+ if (fs && is_linux_swap(fs->name)) {
|
||||
dasd_data->system = PARTITION_LINUX_SWAP;
|
||||
PDEBUG;
|
||||
}
|
||||
--
|
||||
1.6.6
|
||||
|
@ -1,842 +0,0 @@
|
||||
From 6c4c8464c704b645ddeccce4c4931b8e9d11c3a8 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Fri, 29 Jan 2010 10:58:17 +0100
|
||||
Subject: [PATCH parted 1/7] linux: Fixup phys_sector_size setting
|
||||
|
||||
1) Use the logical sector size as physical sector size instead of 512
|
||||
when not compiled with libblkid support, this fixes problems
|
||||
with logical sector size > physical sector size.
|
||||
2) blkid_topology_get_physical_sector_size() can return 0 when it could
|
||||
not determine the physical sector size, handle this.
|
||||
* libparted/arch/linux.c (_device_set_sector_size): Fixup
|
||||
phys_sector_size setting.
|
||||
---
|
||||
libparted/arch/linux.c | 17 +++++++++++------
|
||||
2 files changed, 14 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
||||
index f3b54f0..4b7b9f5 100644
|
||||
--- a/libparted/arch/linux.c
|
||||
+++ b/libparted/arch/linux.c
|
||||
@@ -654,22 +654,27 @@ _device_set_sector_size (PedDevice* dev)
|
||||
dev->path, strerror (errno), PED_SECTOR_SIZE_DEFAULT);
|
||||
} else {
|
||||
dev->sector_size = (long long)sector_size;
|
||||
+ dev->phys_sector_size = dev->sector_size;
|
||||
}
|
||||
|
||||
#if USE_BLKID
|
||||
get_blkid_topology(arch_specific);
|
||||
if (!arch_specific->topology) {
|
||||
- ped_exception_throw (
|
||||
- PED_EXCEPTION_WARNING,
|
||||
- PED_EXCEPTION_OK,
|
||||
- _("Could not determine minimum io size for %s: %s.\n"
|
||||
- "Using the default size (%lld)."),
|
||||
- dev->path, strerror (errno), PED_SECTOR_SIZE_DEFAULT);
|
||||
+ dev->phys_sector_size = 0;
|
||||
} else {
|
||||
dev->phys_sector_size =
|
||||
blkid_topology_get_physical_sector_size(
|
||||
arch_specific->topology);
|
||||
}
|
||||
+ if (dev->phys_sector_size == 0) {
|
||||
+ ped_exception_throw (
|
||||
+ PED_EXCEPTION_WARNING,
|
||||
+ PED_EXCEPTION_OK,
|
||||
+ _("Could not determine physical sector size for %s.\n"
|
||||
+ "Using the logical sector size (%lld)."),
|
||||
+ dev->path, dev->sector_size);
|
||||
+ dev->phys_sector_size = dev->sector_size;
|
||||
+ }
|
||||
#endif
|
||||
|
||||
#if defined __s390__ || defined __s390x__
|
||||
--
|
||||
1.6.6
|
||||
|
||||
From 4bb123a121b54d758f87fc6c38d8edab4ddc6d6b Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Fri, 29 Jan 2010 19:55:10 +0100
|
||||
Subject: [PATCH parted 2/7] libparted: Give device_get_*_alignment sane defaults
|
||||
|
||||
When the topology info is incomplete or non existent, return something
|
||||
more sensible then NULL (which ends up being interpreted as
|
||||
PedAlignmentAny in most cases). The default minimum alignment aligns to
|
||||
physical sector size, the default optimal alignment is 1 MiB, which is
|
||||
what vista and windows 7 do.
|
||||
* libparted/device.c (device_get_*_alignment): Add default aligments.
|
||||
---
|
||||
libparted/device.c | 30 ++++++++++++++++++++++++++----
|
||||
2 files changed, 33 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libparted/device.c b/libparted/device.c
|
||||
index dda8d74..0f36a03 100644
|
||||
--- a/libparted/device.c
|
||||
+++ b/libparted/device.c
|
||||
@@ -501,10 +501,16 @@ ped_device_get_optimal_aligned_constraint(const PedDevice *dev)
|
||||
PedAlignment*
|
||||
ped_device_get_minimum_alignment(const PedDevice *dev)
|
||||
{
|
||||
+ PedAlignment *align = NULL;
|
||||
+
|
||||
if (ped_architecture->dev_ops->get_minimum_alignment)
|
||||
- return ped_architecture->dev_ops->get_minimum_alignment(dev);
|
||||
+ align = ped_architecture->dev_ops->get_minimum_alignment(dev);
|
||||
+
|
||||
+ if (align == NULL)
|
||||
+ align = ped_alignment_new(0,
|
||||
+ dev->phys_sector_size / dev->sector_size);
|
||||
|
||||
- return NULL; /* ped_alignment_none */
|
||||
+ return align;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -521,10 +527,26 @@ ped_device_get_minimum_alignment(const PedDevice *dev)
|
||||
PedAlignment*
|
||||
ped_device_get_optimum_alignment(const PedDevice *dev)
|
||||
{
|
||||
+ PedAlignment *align = NULL;
|
||||
+
|
||||
if (ped_architecture->dev_ops->get_optimum_alignment)
|
||||
- return ped_architecture->dev_ops->get_optimum_alignment(dev);
|
||||
+ align = ped_architecture->dev_ops->get_optimum_alignment(dev);
|
||||
+
|
||||
+ /* If the arch specific code could not give as an alignment
|
||||
+ return a default value based on the type of device. */
|
||||
+ if (align == NULL) {
|
||||
+ switch (dev->type) {
|
||||
+ case PED_DEVICE_DASD:
|
||||
+ align = ped_device_get_minimum_alignment(dev);
|
||||
+ break;
|
||||
+ default:
|
||||
+ /* Align to a grain of 1MiB (like vista / win7) */
|
||||
+ align = ped_alignment_new(0,
|
||||
+ 1048576 / dev->sector_size);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- return NULL; /* ped_alignment_none */
|
||||
+ return align;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
--
|
||||
1.6.6
|
||||
|
||||
From 82f42a9e059a8f5dea46090889914041204ebe36 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Fri, 29 Jan 2010 19:59:06 +0100
|
||||
Subject: [PATCH parted 3/7] linux: handle incomplete topology information
|
||||
|
||||
The topology information returned by libblkid is not always complete
|
||||
(as the kernel does not always have complete information).
|
||||
This patch makes the linux_get_*_alignment() alignment functions handle
|
||||
this. The algorithm used for linux_get_optimum_alignment is:
|
||||
1) Always use the reported aligment offset as offset
|
||||
2a)If optimal io size is present in the topology info use that as grain
|
||||
2b)If optimal io size is not present in topology info and aligment
|
||||
offset is 0 and minimum io size is a power of 2, use the device.c
|
||||
default optimal alignment (grain 1MiB).
|
||||
2c)If not 2a and 2b, use the minimum io size, or if that is not defined
|
||||
the physical sector size as grain (iow the minimum alignment).
|
||||
The algorithm used for linux_get_minimum_alignment is:
|
||||
1) Always use the reported aligment offset as offset
|
||||
2) Use the minimum io size, or if that is not defined the physical
|
||||
sector size as grain.
|
||||
* libparted/arch/linux.c (linux_get_*_alignment): handle incomplete
|
||||
topology information.
|
||||
---
|
||||
libparted/arch/linux.c | 25 +++++++++++++++++++++----
|
||||
1 files changed, 21 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
||||
index 4b7b9f5..a083028 100644
|
||||
--- a/libparted/arch/linux.c
|
||||
+++ b/libparted/arch/linux.c
|
||||
@@ -2564,9 +2564,14 @@ PedAlignment*
|
||||
linux_get_minimum_alignment(const PedDevice *dev)
|
||||
{
|
||||
blkid_topology tp = LINUX_SPECIFIC(dev)->topology;
|
||||
+ if (!tp)
|
||||
+ return NULL;
|
||||
|
||||
- if (!tp || blkid_topology_get_minimum_io_size(tp) == 0)
|
||||
- return NULL; /* ped_alignment_none */
|
||||
+ if (blkid_topology_get_minimum_io_size(tp) == 0)
|
||||
+ return ped_alignment_new(
|
||||
+ blkid_topology_get_alignment_offset(tp) /
|
||||
+ dev->sector_size,
|
||||
+ dev->phys_sector_size / dev->sector_size);
|
||||
|
||||
return ped_alignment_new(
|
||||
blkid_topology_get_alignment_offset(tp) / dev->sector_size,
|
||||
@@ -2577,9 +2582,21 @@ PedAlignment*
|
||||
linux_get_optimum_alignment(const PedDevice *dev)
|
||||
{
|
||||
blkid_topology tp = LINUX_SPECIFIC(dev)->topology;
|
||||
+ if (!tp)
|
||||
+ return NULL;
|
||||
+
|
||||
+ /* If optimal_io_size is 0 _and_ alignment_offset is 0 _and_
|
||||
+ minimum_io_size is a power of 2 then go with the device.c default */
|
||||
+ unsigned long minimum_io_size = blkid_topology_get_minimum_io_size(tp);
|
||||
+ if (blkid_topology_get_optimal_io_size(tp) == 0 &&
|
||||
+ blkid_topology_get_alignment_offset(tp) == 0 &&
|
||||
+ (minimum_io_size & (minimum_io_size - 1)) == 0)
|
||||
+ return NULL;
|
||||
|
||||
- if (!tp || blkid_topology_get_optimal_io_size(tp) == 0)
|
||||
- return NULL; /* ped_alignment_none */
|
||||
+ /* If optimal_io_size is 0 and we don't meet the other criteria
|
||||
+ for using the device.c default, return the minimum alignment. */
|
||||
+ if (blkid_topology_get_optimal_io_size(tp) == 0)
|
||||
+ return linux_get_minimum_alignment(dev);
|
||||
|
||||
return ped_alignment_new(
|
||||
blkid_topology_get_alignment_offset(tp) / dev->sector_size,
|
||||
--
|
||||
1.6.6
|
||||
|
||||
From 4be1b004ad2c576fc093ca5227e22bb78b35f1fd Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Fri, 29 Jan 2010 23:28:13 +0100
|
||||
Subject: [PATCH parted 4/7] parted: Honor --align option also in mkpartfs, resize and print cmds
|
||||
|
||||
parted/parted.c (do_mkpartfs,do_print,do_resize): honor --align
|
||||
---
|
||||
parted/parted.c | 26 +++++++++++++++++++++++++-
|
||||
1 files changed, 25 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/parted/parted.c b/parted/parted.c
|
||||
index c4d1779..5ba8bbf 100644
|
||||
--- a/parted/parted.c
|
||||
+++ b/parted/parted.c
|
||||
@@ -949,6 +949,11 @@ do_mkpartfs (PedDevice** dev)
|
||||
if (!disk)
|
||||
goto error;
|
||||
|
||||
+ if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT))
|
||||
+ if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT,
|
||||
+ alignment == ALIGNMENT_CYLINDER))
|
||||
+ goto error_destroy_disk;
|
||||
+
|
||||
if (!ped_disk_type_check_feature (disk->type, PED_DISK_TYPE_EXTENDED)) {
|
||||
part_type = PED_PARTITION_NORMAL;
|
||||
} else {
|
||||
@@ -989,7 +994,14 @@ do_mkpartfs (PedDevice** dev)
|
||||
range_end);
|
||||
PED_ASSERT (user_constraint != NULL, return 0);
|
||||
|
||||
- dev_constraint = ped_device_get_constraint (*dev);
|
||||
+ if (alignment == ALIGNMENT_OPTIMAL)
|
||||
+ dev_constraint =
|
||||
+ ped_device_get_optimal_aligned_constraint(*dev);
|
||||
+ else if (alignment == ALIGNMENT_MINIMAL)
|
||||
+ dev_constraint =
|
||||
+ ped_device_get_minimal_aligned_constraint(*dev);
|
||||
+ else
|
||||
+ dev_constraint = ped_device_get_constraint(*dev);
|
||||
PED_ASSERT (dev_constraint != NULL, return 0);
|
||||
|
||||
final_constraint = ped_constraint_intersect (user_constraint,
|
||||
@@ -1353,6 +1365,11 @@ do_print (PedDevice** dev)
|
||||
if (!disk)
|
||||
goto error;
|
||||
|
||||
+ if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT))
|
||||
+ if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT,
|
||||
+ alignment == ALIGNMENT_CYLINDER))
|
||||
+ goto error_destroy_disk;
|
||||
+
|
||||
peek_word = command_line_peek_word ();
|
||||
if (peek_word) {
|
||||
if (strncmp (peek_word, "devices", 7) == 0) {
|
||||
@@ -1697,6 +1697,7 @@ do_print (PedDevice** dev)
|
||||
|
||||
return 1;
|
||||
|
||||
+error_destroy_disk:
|
||||
ped_disk_destroy (disk);
|
||||
error:
|
||||
return 0;
|
||||
@@ -1862,6 +1881,11 @@ do_resize (PedDevice** dev)
|
||||
if (!disk)
|
||||
goto error;
|
||||
|
||||
+ if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT))
|
||||
+ if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT,
|
||||
+ alignment == ALIGNMENT_CYLINDER))
|
||||
+ goto error_destroy_disk;
|
||||
+
|
||||
if (!command_line_get_partition (_("Partition number?"), disk, &part))
|
||||
goto error_destroy_disk;
|
||||
if (part->type != PED_PARTITION_EXTENDED) {
|
||||
--
|
||||
1.6.6
|
||||
|
||||
From 950bfc92b1a67c8baa8c7cfab04103bd38a2d24b Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Fri, 29 Jan 2010 22:51:30 +0100
|
||||
Subject: [PATCH parted 5/7] parted: change warnings when initial constrained mkpart fails
|
||||
|
||||
In do_mkpart we first try to create a partition using a constraint
|
||||
derived from the user input intersected with the devices alignment
|
||||
needs. And if that fails we try again without any constraint.
|
||||
|
||||
However the warning given when this happens only takes into account
|
||||
the user not getting what he asked for, while the alignment might be
|
||||
a problem too (or even the only problem). So this patch adds a check
|
||||
to see if the user really did not get what he asked before giving that
|
||||
warning, and adds a new check + warning to see if the created partition
|
||||
is properly aligned.
|
||||
*parted/parted.c (do_mkpart,do_mkpartfs): change warnings when initial
|
||||
constrained mkpart fails.
|
||||
---
|
||||
parted/parted.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++------
|
||||
1 files changed, 52 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/parted/parted.c b/parted/parted.c
|
||||
index 5ba8bbf..3ce356f 100644
|
||||
--- a/parted/parted.c
|
||||
+++ b/parted/parted.c
|
||||
@@ -178,6 +178,8 @@ static TimerContext timer_context;
|
||||
|
||||
static int _print_list ();
|
||||
static void _done (PedDevice* dev);
|
||||
+static bool partition_align_check (PedDisk const *disk,
|
||||
+ PedPartition const *part, enum AlignmentType a_type);
|
||||
|
||||
static void
|
||||
_timer_handler (PedTimer* timer, void* context)
|
||||
@@ -833,7 +835,12 @@ do_mkpart (PedDevice** dev)
|
||||
bool added_ok = ped_disk_add_partition (disk, part,
|
||||
constraint_any);
|
||||
ped_constraint_destroy (constraint_any);
|
||||
- if (added_ok) {
|
||||
+
|
||||
+ if (!added_ok)
|
||||
+ goto error_remove_part;
|
||||
+
|
||||
+ if (!ped_geometry_test_sector_inside(range_start, part->geom.start) ||
|
||||
+ !ped_geometry_test_sector_inside(range_end, part->geom.end)) {
|
||||
start_usr = ped_unit_format (*dev, start);
|
||||
end_usr = ped_unit_format (*dev, end);
|
||||
start_sol = ped_unit_format (*dev, part->geom.start);
|
||||
@@ -867,8 +874,23 @@ do_mkpart (PedDevice** dev)
|
||||
/* undo partition addition */
|
||||
goto error_remove_part;
|
||||
}
|
||||
- } else {
|
||||
- goto error_remove_part;
|
||||
+ }
|
||||
+
|
||||
+ if ((alignment == ALIGNMENT_OPTIMAL &&
|
||||
+ !partition_align_check(disk, part, PA_OPTIMUM)) ||
|
||||
+ (alignment == ALIGNMENT_MINIMAL &&
|
||||
+ !partition_align_check(disk, part, PA_MINIMUM))) {
|
||||
+ if (ped_exception_throw(
|
||||
+ PED_EXCEPTION_WARNING,
|
||||
+ (opt_script_mode
|
||||
+ ? PED_EXCEPTION_OK
|
||||
+ : PED_EXCEPTION_IGNORE_CANCEL),
|
||||
+ _("The resulting partition is not properly "
|
||||
+ "aligned for best performance.")) ==
|
||||
+ PED_EXCEPTION_CANCEL) {
|
||||
+ /* undo partition addition */
|
||||
+ goto error_remove_part;
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
ped_exception_leave_all();
|
||||
@@ -1018,8 +1040,16 @@ do_mkpartfs (PedDevice** dev)
|
||||
if (!added_ok) {
|
||||
ped_exception_leave_all();
|
||||
|
||||
- if (ped_disk_add_partition (disk, part,
|
||||
- ped_constraint_any (*dev))) {
|
||||
+ PedConstraint *constraint_any = ped_constraint_any (*dev);
|
||||
+ bool added_ok = ped_disk_add_partition (disk, part,
|
||||
+ constraint_any);
|
||||
+ ped_constraint_destroy (constraint_any);
|
||||
+
|
||||
+ if (!added_ok)
|
||||
+ goto error_remove_part;
|
||||
+
|
||||
+ if (!ped_geometry_test_sector_inside(range_start, part->geom.start) ||
|
||||
+ !ped_geometry_test_sector_inside(range_end, part->geom.end)) {
|
||||
start_usr = ped_unit_format (*dev, start);
|
||||
end_usr = ped_unit_format (*dev, end);
|
||||
start_sol = ped_unit_format (*dev, part->geom.start);
|
||||
@@ -1048,8 +1078,23 @@ do_mkpartfs (PedDevice** dev)
|
||||
/* undo partition addition */
|
||||
goto error_remove_part;
|
||||
}
|
||||
- } else {
|
||||
- goto error_remove_part;
|
||||
+ }
|
||||
+
|
||||
+ if ((alignment == ALIGNMENT_OPTIMAL &&
|
||||
+ !partition_align_check(disk, part, PA_OPTIMUM)) ||
|
||||
+ (alignment == ALIGNMENT_MINIMAL &&
|
||||
+ !partition_align_check(disk, part, PA_MINIMUM))) {
|
||||
+ if (ped_exception_throw(
|
||||
+ PED_EXCEPTION_WARNING,
|
||||
+ (opt_script_mode
|
||||
+ ? PED_EXCEPTION_OK
|
||||
+ : PED_EXCEPTION_IGNORE_CANCEL),
|
||||
+ _("The resulting partition is not properly "
|
||||
+ "aligned for best performance.")) ==
|
||||
+ PED_EXCEPTION_CANCEL) {
|
||||
+ /* undo partition addition */
|
||||
+ goto error_remove_part;
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
ped_exception_leave_all();
|
||||
--
|
||||
1.6.6
|
||||
|
||||
From 6c2db872647816b84a5efc8c8995a019d47f89a9 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sat, 30 Jan 2010 17:46:23 +0100
|
||||
Subject: [PATCH parted 6/7] Makefiles: Fix check-other-sector_sizes
|
||||
|
||||
Atleast on my system check-other-sector_sizes was actually just testing
|
||||
512 bytes sectors 4 times. This fixes this.
|
||||
* Makefile.am: Fix check-other-sector_sizes
|
||||
---
|
||||
Makefile.am | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 0e80967..d5a32ef 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -1415,7 +1415,7 @@ MAINTAINERCLEANFILES += \
|
||||
|
||||
.PHONY: ss-1024 ss-2048 ss-4096
|
||||
ss-1024 ss-2048 ss-4096:
|
||||
- PARTED_SECTOR_SIZE=$(ss-,,$@) $(MAKE) check-recursive
|
||||
+ PARTED_SECTOR_SIZE=$(subst ss-,,$@) $(MAKE) check-recursive
|
||||
|
||||
# Run the regression test suite with different settings,
|
||||
# to ensure it works with simulated partition sizes > 512.
|
||||
--
|
||||
1.6.6
|
||||
|
||||
From 6ba62ce27f84c5c931d021f4be4af0cce011bdbf Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Fri, 29 Jan 2010 20:30:18 +0100
|
||||
Subject: [PATCH parted 7/7] parted: Change default alignment to optimal
|
||||
|
||||
parted/parted.c: change --align default value to optimal
|
||||
tests/*.sh: adjust for alignment changes where necessary
|
||||
---
|
||||
parted/parted.c | 2 +-
|
||||
tests/t0220-gpt-msftres.sh | 4 ++--
|
||||
tests/t0280-gpt-corrupt.sh | 6 +++---
|
||||
tests/t2100-mkswap.sh | 14 +++++++-------
|
||||
tests/t2200-dos-label-recog.sh | 11 ++++++-----
|
||||
tests/t2300-dos-label-extended-bootcode.sh | 12 ++++++------
|
||||
tests/t3000-resize-fs.sh | 4 ++--
|
||||
tests/t4100-dvh-partition-limits.sh | 4 +++-
|
||||
tests/t4100-msdos-partition-limits.sh | 22 +++++-----------------
|
||||
tests/t4100-msdos-starting-sector.sh | 10 +++++-----
|
||||
tests/t5000-tags.sh | 6 +++---
|
||||
tests/t8000-loop.sh | 1 +
|
||||
tests/t9021-maxima.sh | 3 ++-
|
||||
14 files changed, 49 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/parted/parted.c b/parted/parted.c
|
||||
index 3ce356f..e35ce6a 100644
|
||||
--- a/parted/parted.c
|
||||
+++ b/parted/parted.c
|
||||
@@ -133,7 +133,7 @@ int pretend_input_tty = 0;
|
||||
int opt_machine_mode = 0;
|
||||
int disk_is_modified = 0;
|
||||
int is_toggle_mode = 0;
|
||||
-int alignment = ALIGNMENT_CYLINDER;
|
||||
+int alignment = ALIGNMENT_OPTIMAL;
|
||||
|
||||
static const char* number_msg = N_(
|
||||
"NUMBER is the partition number used by Linux. On MS-DOS disk labels, the "
|
||||
diff --git a/tests/t0220-gpt-msftres.sh b/tests/t0220-gpt-msftres.sh
|
||||
index 8ef885f..bbc415b 100755
|
||||
--- a/tests/t0220-gpt-msftres.sh
|
||||
+++ b/tests/t0220-gpt-msftres.sh
|
||||
@@ -35,8 +35,8 @@ NTFS
|
||||
reiserfs
|
||||
'
|
||||
|
||||
-start=200
|
||||
-part_size=100
|
||||
+start=2048
|
||||
+part_size=2048
|
||||
n_types=$(echo "$fs_types"|wc -w)
|
||||
|
||||
# Create a "disk" with enough room for one partition per FS type,
|
||||
diff --git a/tests/t0280-gpt-corrupt.sh b/tests/t0280-gpt-corrupt.sh
|
||||
index 28c9035..5c48116 100755
|
||||
--- a/tests/t0280-gpt-corrupt.sh
|
||||
+++ b/tests/t0280-gpt-corrupt.sh
|
||||
@@ -43,7 +43,7 @@ poke()
|
||||
dev=loop-file
|
||||
|
||||
ss=$sector_size_
|
||||
-n_sectors=200
|
||||
+n_sectors=5000
|
||||
|
||||
fail=0
|
||||
dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
|
||||
@@ -62,7 +62,7 @@ printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt:;\n" \
|
||||
compare exp out || fail=1
|
||||
|
||||
# create a partition
|
||||
-parted -s $dev mkpart sw linux-swap 60s 100s > empty 2>&1 || fail=1
|
||||
+parted -s $dev mkpart sw linux-swap 2048s 4095s > empty 2>&1 || fail=1
|
||||
compare /dev/null empty || fail=1
|
||||
|
||||
# We're going to change the name of the first partition,
|
||||
@@ -123,7 +123,7 @@ compare exp err || fail=1
|
||||
parted -m -s $dev u s print > out 2>&1 || fail=1
|
||||
|
||||
# check for expected output
|
||||
-printf "BYT;\nfile\n1:60s:100s:41s::foo:;\n" > exp || fail=1
|
||||
+printf "BYT;\nfile\n1:2048s:4095s:2048s::foo:;\n" > exp || fail=1
|
||||
sed "s/.*gpt:;/file/" out > k && mv k out || fail=1
|
||||
compare exp out || fail=1
|
||||
|
||||
diff --git a/tests/t2100-mkswap.sh b/tests/t2100-mkswap.sh
|
||||
index 1462e5d..1e4c444 100755
|
||||
--- a/tests/t2100-mkswap.sh
|
||||
+++ b/tests/t2100-mkswap.sh
|
||||
@@ -27,7 +27,7 @@ require_512_byte_sector_size_
|
||||
# table, ensure that the proper file system type (0x82) is used.
|
||||
# Some releases, e.g. parted-1.8.8 would mistakenly use 0x83.
|
||||
######################################################################
|
||||
-N=1M
|
||||
+N=2M
|
||||
dev=loop-file
|
||||
dev2=loop-file-2
|
||||
test_expect_success \
|
||||
@@ -41,7 +41,7 @@ test_expect_success 'expect no output' 'compare out /dev/null'
|
||||
|
||||
test_expect_success \
|
||||
'create a partition' \
|
||||
- 'parted -s $dev mkpart primary 0 1 > out 2>&1'
|
||||
+ 'parted -s $dev mkpart primary 2048s 4095s > out 2>&1'
|
||||
test_expect_success 'expect no output' 'compare out /dev/null'
|
||||
|
||||
test_expect_success \
|
||||
@@ -66,7 +66,7 @@ test_expect_success 'expect no output' 'compare out /dev/null'
|
||||
|
||||
test_expect_success \
|
||||
'create another partition' \
|
||||
- 'parted -s $dev2 mkpart primary 0 1 > out 2>&1'
|
||||
+ 'parted -s $dev2 mkpart primary 2048s 4095s > out 2>&1'
|
||||
test_expect_success 'expect no output' 'compare out /dev/null'
|
||||
|
||||
test_expect_success \
|
||||
@@ -74,13 +74,13 @@ test_expect_success \
|
||||
'parted -s $dev2 mkfs 1 "linux-swap(v1)" > out 2>&1'
|
||||
test_expect_success 'expect no output' 'compare out /dev/null'
|
||||
|
||||
-# partition starts at offset 16384; swap UUID is 1036 bytes in
|
||||
+# partition starts at offset 1048576; swap UUID is 1036 bytes in
|
||||
test_expect_success \
|
||||
'extract UUID 1' \
|
||||
- 'od -t x1 -An -j17420 -N16 $dev > uuid1'
|
||||
+ 'od -t x1 -An -j1049612 -N16 $dev > uuid1'
|
||||
test_expect_success \
|
||||
'extract UUID 2' \
|
||||
- 'od -t x1 -An -j17420 -N16 $dev2 > uuid2'
|
||||
+ 'od -t x1 -An -j1049612 -N16 $dev2 > uuid2'
|
||||
test_expect_failure \
|
||||
'two linux-swap file systems have different UUIDs' \
|
||||
'compare uuid1 uuid2'
|
||||
@@ -92,7 +92,7 @@ test_expect_success 'expect no output' 'compare out /dev/null'
|
||||
|
||||
test_expect_success \
|
||||
'extract new UUID 2' \
|
||||
- 'od -t x1 -An -j17420 -N16 $dev2 > uuid2-new'
|
||||
+ 'od -t x1 -An -j1049612 -N16 $dev2 > uuid2-new'
|
||||
test_expect_success \
|
||||
'check preserves linux-swap UUID' \
|
||||
'compare uuid2 uuid2-new'
|
||||
diff --git a/tests/t2200-dos-label-recog.sh b/tests/t2200-dos-label-recog.sh
|
||||
index 1254226..92e6d42 100755
|
||||
--- a/tests/t2200-dos-label-recog.sh
|
||||
+++ b/tests/t2200-dos-label-recog.sh
|
||||
@@ -25,11 +25,12 @@ test_description='improved MSDOS partition-table recognition'
|
||||
# parted 1.8.8.1.29 and earlier would fail to recognize a DOS
|
||||
# partition table.
|
||||
######################################################################
|
||||
-N=10M
|
||||
+ss=$sector_size_
|
||||
+N=8192
|
||||
dev=loop-file
|
||||
test_expect_success \
|
||||
'create a file to simulate the underlying device' \
|
||||
- 'dd if=/dev/null of=$dev bs=1 seek=$N 2> /dev/null'
|
||||
+ 'dd if=/dev/null of=$dev bs=$ss seek=$N 2> /dev/null'
|
||||
|
||||
test_expect_success \
|
||||
'label the test disk' \
|
||||
@@ -39,8 +40,8 @@ test_expect_success 'expect no output' 'compare out /dev/null'
|
||||
test_expect_success \
|
||||
'create two partition' \
|
||||
'
|
||||
- parted -s $dev mkpart primary 1s 40s > out 2>&1 &&
|
||||
- parted -s $dev mkpart primary 41s 80s >> out 2>&1
|
||||
+ parted -s $dev mkpart primary 2048s 4095s > out 2>&1 &&
|
||||
+ parted -s $dev mkpart primary 4096s 8191s >> out 2>&1
|
||||
|
||||
'
|
||||
test_expect_success 'expect no output' 'compare out /dev/null'
|
||||
@@ -54,7 +55,7 @@ test_expect_success \
|
||||
'
|
||||
parted -m -s $dev unit s p > out &&
|
||||
tail -2 out > k && mv k out &&
|
||||
- printf "1:1s:40s:40s:::;\n2:41s:80s:40s:::;\n" > exp
|
||||
+ printf "1:2048s:4095s:2048s:::;\n2:4096s:8191s:4096s:::;\n" > exp
|
||||
|
||||
'
|
||||
test_expect_success 'expect two partitions' 'compare out exp'
|
||||
diff --git a/tests/t2300-dos-label-extended-bootcode.sh b/tests/t2300-dos-label-extended-bootcode.sh
|
||||
index 6f2b219..73fa45b 100755
|
||||
--- a/tests/t2300-dos-label-extended-bootcode.sh
|
||||
+++ b/tests/t2300-dos-label-extended-bootcode.sh
|
||||
@@ -27,7 +27,7 @@ bootcode_size=446
|
||||
|
||||
test_expect_success \
|
||||
'Create the test file' \
|
||||
- 'dd if=/dev/zero of=$dev bs=1024c count=100 >/dev/null 2>&1'
|
||||
+ 'dd if=/dev/zero of=$dev bs=1M count=4 >/dev/null 2>&1'
|
||||
|
||||
test_expect_success \
|
||||
'Create msdos label' \
|
||||
@@ -36,23 +36,23 @@ test_expect_success 'Expect no output' 'compare out /dev/null'
|
||||
|
||||
test_expect_success \
|
||||
'Create extended partition' \
|
||||
- 'parted -s $dev mkpart extended 32s 127s > out 2>&1'
|
||||
+ 'parted -s $dev mkpart extended 2048s 8191s > out 2>&1'
|
||||
test_expect_success 'Expect no output' 'compare out /dev/null'
|
||||
|
||||
test_expect_success \
|
||||
'Create logical partition' \
|
||||
- 'parted -s $dev mkpart logical 64s 127s > out 2>&1'
|
||||
+ 'parted -s $dev mkpart logical 4096s 8191s > out 2>&1'
|
||||
test_expect_success 'Expect no output' 'compare out /dev/null'
|
||||
|
||||
test_expect_success \
|
||||
'Install fake bootcode' \
|
||||
'printf %0${bootcode_size}d 0 > in &&
|
||||
- dd if=in of=$dev bs=1c seek=16384 count=$bootcode_size \
|
||||
+ dd if=in of=$dev bs=1c seek=1M count=$bootcode_size \
|
||||
conv=notrunc > /dev/null 2>&1'
|
||||
|
||||
test_expect_success \
|
||||
'Save fake bootcode for later comparison' \
|
||||
- 'dd if=$dev of=before bs=1 skip=16384 count=$bootcode_size > /dev/null 2>&1'
|
||||
+ 'dd if=$dev of=before bs=1 skip=1M count=$bootcode_size > /dev/null 2>&1'
|
||||
|
||||
test_expect_success \
|
||||
'Do something to the label' \
|
||||
@@ -61,7 +61,7 @@ test_expect_success 'Expect no output' 'compare out /dev/null'
|
||||
|
||||
test_expect_success \
|
||||
'Extract the bootcode for comparison' \
|
||||
- 'dd if=$dev of=after bs=1 skip=16384 count=$bootcode_size > /dev/null 2>&1'
|
||||
+ 'dd if=$dev of=after bs=1 skip=1M count=$bootcode_size > /dev/null 2>&1'
|
||||
|
||||
test_expect_success \
|
||||
'Expect bootcode has not changed' \
|
||||
diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
|
||||
index 2abc71b..d6af67d 100755
|
||||
--- a/tests/t3000-resize-fs.sh
|
||||
+++ b/tests/t3000-resize-fs.sh
|
||||
@@ -64,8 +64,8 @@ for fs_type in hfs+ fat32; do
|
||||
|
||||
# create an empty $fs_type partition, cylinder aligned, size > 256 MB
|
||||
parted -s $dev mkpart primary $fs_type $start $default_end > out 2>&1 || fail=1
|
||||
- # expect no output
|
||||
- compare out /dev/null || fail=1
|
||||
+ echo "Warning: The resulting partition is not properly aligned for best performance." > exp
|
||||
+ compare out exp || fail=1
|
||||
|
||||
# print partition table
|
||||
parted -m -s $dev u s p > out 2>&1 || fail=1
|
||||
diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh
|
||||
index 01e3078..17b1530 100755
|
||||
--- a/tests/t4100-dvh-partition-limits.sh
|
||||
+++ b/tests/t4100-dvh-partition-limits.sh
|
||||
@@ -33,11 +33,13 @@ fs=fs_file
|
||||
mp=`pwd`/mount-point
|
||||
n=4096
|
||||
|
||||
+# We must use -f otherwise newer mkfs.xfs fail with:
|
||||
+# mkfs.xfs: probe of test.img failed, cannot detect existing filesystem.
|
||||
test_expect_success \
|
||||
'create an XFS file system' \
|
||||
'
|
||||
dd if=/dev/zero of=$fs bs=1MB count=2 seek=20 &&
|
||||
- mkfs.xfs -q $fs &&
|
||||
+ mkfs.xfs -f -q $fs &&
|
||||
mkdir "$mp"
|
||||
|
||||
'
|
||||
diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh
|
||||
index 0c5b404..b9f168a 100755
|
||||
--- a/tests/t4100-msdos-partition-limits.sh
|
||||
+++ b/tests/t4100-msdos-partition-limits.sh
|
||||
@@ -33,11 +33,13 @@ fs=fs_file
|
||||
mp=`pwd`/mount-point
|
||||
n=4096
|
||||
|
||||
+# We must use -f otherwise newer mkfs.xfs fail with:
|
||||
+# mkfs.xfs: probe of test.img failed, cannot detect existing filesystem.
|
||||
test_expect_success \
|
||||
'create an XFS file system' \
|
||||
'
|
||||
dd if=/dev/zero of=$fs bs=1MB count=2 seek=20 &&
|
||||
- mkfs.xfs -q $fs &&
|
||||
+ mkfs.xfs -f -q $fs &&
|
||||
mkdir "$mp"
|
||||
|
||||
'
|
||||
@@ -102,27 +104,13 @@ test_expect_success \
|
||||
'check for new diagnostic' \
|
||||
'bad_part_length 4294967296 > exp && diff -u err exp'
|
||||
|
||||
-# FIXME: investigate this.
|
||||
-# Unexpectedly to me, both of these failed with this same diagnostic:
|
||||
-#
|
||||
-# Error: partition length of 4294967296 sectors exceeds the \
|
||||
-# DOS-partition-table-imposed maximum of 2^32-1" > exp &&
|
||||
-#
|
||||
-# I expected the one below to fail with a length of _4294967297_.
|
||||
-# Debugging, I see that _check_partition *does* detect this,
|
||||
-# but the diagnostic doesn't get displayed because of the wonders
|
||||
-# of parted's exception mechanism.
|
||||
-
|
||||
test_expect_failure \
|
||||
"$table_type: a partition length of 2^32+1 sectors provokes failure." \
|
||||
'do_mkpart $n $(echo $n+2^32|bc) > err 2>&1'
|
||||
|
||||
-# FIXME: odd that we asked for 2^32+1, yet the diagnostic says 2^32
|
||||
-# FIXME: Probably due to constraints.
|
||||
-# FIXME: For now, just accept the current output.
|
||||
test_expect_success \
|
||||
'check for new diagnostic' \
|
||||
- 'bad_part_length 4294967296 > exp && diff -u err exp'
|
||||
+ 'bad_part_length 4294967297 > exp && diff -u err exp'
|
||||
|
||||
# =========================================================
|
||||
# Now consider partition starting sector numbers.
|
||||
@@ -164,7 +152,7 @@ test_expect_failure \
|
||||
'do_mkpart_start_and_len $(echo 2^32+1|bc) 1000 > err 2>&1'
|
||||
test_expect_success \
|
||||
'check for new diagnostic' \
|
||||
- 'bad_start_sector 4294967296 > exp && diff -u err exp'
|
||||
+ 'bad_start_sector 4294967297 > exp && diff -u err exp'
|
||||
|
||||
done
|
||||
|
||||
diff --git a/tests/t4100-msdos-starting-sector.sh b/tests/t4100-msdos-starting-sector.sh
|
||||
index 7761e75..3d0233b 100755
|
||||
--- a/tests/t4100-msdos-starting-sector.sh
|
||||
+++ b/tests/t4100-msdos-starting-sector.sh
|
||||
@@ -27,7 +27,7 @@ ss=$sector_size_
|
||||
# consistent in the use of metadata padding for msdos labels.
|
||||
######################################################################
|
||||
|
||||
-N=200 # number of sectors
|
||||
+N=4096 # number of sectors
|
||||
dev=loop-file
|
||||
test_expect_success \
|
||||
'create a file to simulate the underlying device' \
|
||||
@@ -43,7 +43,7 @@ fail=0
|
||||
cat <<EOF > exp || fail=1
|
||||
BYT;
|
||||
path:${N}s:file:$ss:$ss:msdos:;
|
||||
-1:32s:127s:96s:free;
|
||||
+1:32s:4095s:4064s:free;
|
||||
EOF
|
||||
|
||||
test_expect_success 'create expected output file' 'test $fail = 0'
|
||||
@@ -62,15 +62,15 @@ fail=0
|
||||
cat <<EOF > exp || fail=1
|
||||
BYT;
|
||||
path:${N}s:file:$ss:$ss:msdos:;
|
||||
-1:32s:50s:19s:free;
|
||||
-1:51s:199s:149s:::;
|
||||
+1:32s:2047s:2016s:free;
|
||||
+1:2048s:4095s:2048s:::;
|
||||
EOF
|
||||
|
||||
test_expect_success 'create expected output file' 'test $fail = 0'
|
||||
|
||||
test_expect_success \
|
||||
'create a partition at the end of the label' \
|
||||
- 'parted -s $dev mkpart primary 51s 199s'
|
||||
+ 'parted -s $dev mkpart primary 2048s 4095s'
|
||||
|
||||
test_expect_success \
|
||||
'display output of label with partition' \
|
||||
diff --git a/tests/t5000-tags.sh b/tests/t5000-tags.sh
|
||||
index d1e9533..9b0a1cc 100755
|
||||
--- a/tests/t5000-tags.sh
|
||||
+++ b/tests/t5000-tags.sh
|
||||
@@ -22,10 +22,10 @@ test_description="test bios_grub flag in gpt labels"
|
||||
ss=$sector_size_
|
||||
|
||||
dev=loop-file
|
||||
-N=300 # number of sectors
|
||||
+N=4200 # number of sectors
|
||||
|
||||
-part_sectors=128
|
||||
-start_sector=60
|
||||
+part_sectors=2048
|
||||
+start_sector=2048
|
||||
end_sector=$(expr $start_sector + $part_sectors - 1)
|
||||
|
||||
test_expect_success \
|
||||
diff --git a/tests/t8000-loop.sh b/tests/t8000-loop.sh
|
||||
index 313e3b8..cba3454 100755
|
||||
--- a/tests/t8000-loop.sh
|
||||
+++ b/tests/t8000-loop.sh
|
||||
@@ -25,6 +25,7 @@ fi
|
||||
. $srcdir/t-lib.sh
|
||||
|
||||
require_root_
|
||||
+lvm_init_root_dir_
|
||||
|
||||
d1= f1=
|
||||
cleanup_()
|
||||
diff --git a/tests/t9021-maxima.sh b/tests/t9021-maxima.sh
|
||||
index 999a696..c8316bc 100755
|
||||
--- a/tests/t9021-maxima.sh
|
||||
+++ b/tests/t9021-maxima.sh
|
||||
@@ -25,6 +25,7 @@ fi
|
||||
. $srcdir/t-lib.sh
|
||||
|
||||
fail=0
|
||||
+ss=$sector_size_
|
||||
dev=dev-file
|
||||
PATH="..:$PATH"
|
||||
export PATH
|
||||
@@ -33,7 +34,7 @@ export PATH
|
||||
for t in msdos gpt dvh sun mac bsd amiga loop pc98; do
|
||||
echo $t
|
||||
rm -f $dev
|
||||
- dd if=/dev/zero of=$dev bs=512 count=1 seek=10000 || { fail=1; continue; }
|
||||
+ dd if=/dev/zero of=$dev bs=$ss count=1 seek=10000 || { fail=1; continue; }
|
||||
parted -s $dev mklabel $t || { fail=1; continue; }
|
||||
|
||||
#case $t in pc98) sleep 999d;; esac
|
||||
--
|
||||
1.6.6
|
||||
|
@ -1,146 +0,0 @@
|
||||
From 28be933ce317f954be1e39a50d8f42197d6e3c15 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Meyering <meyering@redhat.com>
|
||||
Date: Sun, 7 Feb 2010 20:31:11 +0100
|
||||
Subject: [PATCH parted 01/10] gpt: read-only operation could clobber MBR part of hybrid GPT+MBR table
|
||||
|
||||
* libparted/labels/gpt.c (gpt_read): Fix a bug introduced by me in
|
||||
commit 7f753b1b, "gpt: rewrite GPT header-reading code".
|
||||
Set write_back=0 in one more code path.
|
||||
* tests/Makefile.am (TESTS): Add t0205-gpt-list-clobbers-pmbr.sh.
|
||||
* tests/t0205-gpt-list-clobbers-pmbr.sh: New test.
|
||||
Reported by aix27249 in
|
||||
http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/250
|
||||
---
|
||||
libparted/labels/gpt.c | 10 ++++--
|
||||
tests/Makefile.am | 1 +
|
||||
tests/t0205-gpt-list-clobbers-pmbr.sh | 59 +++++++++++++++++++++++++++++++++
|
||||
4 files changed, 72 insertions(+), 3 deletions(-)
|
||||
create mode 100644 tests/t0205-gpt-list-clobbers-pmbr.sh
|
||||
|
||||
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
|
||||
index 9d9876c..ea96a3b 100644
|
||||
--- a/libparted/labels/gpt.c
|
||||
+++ b/libparted/labels/gpt.c
|
||||
@@ -4,7 +4,7 @@
|
||||
original version by Matt Domsch <Matt_Domsch@dell.com>
|
||||
Disclaimed into the Public Domain
|
||||
|
||||
- Portions Copyright (C) 2001-2003, 2005-2009 Free Software Foundation, Inc.
|
||||
+ Portions Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc.
|
||||
|
||||
EFI GUID Partition Table handling
|
||||
Per Intel EFI Specification v1.02
|
||||
@@ -932,9 +932,9 @@ gpt_read (PedDisk *disk)
|
||||
if (primary_gpt && backup_gpt)
|
||||
{
|
||||
/* Both are valid. */
|
||||
+#ifndef DISCOVER_ONLY
|
||||
if (PED_LE64_TO_CPU (primary_gpt->AlternateLBA) < disk->dev->length - 1)
|
||||
{
|
||||
-#ifndef DISCOVER_ONLY
|
||||
switch (ped_exception_throw
|
||||
(PED_EXCEPTION_ERROR,
|
||||
(PED_EXCEPTION_FIX | PED_EXCEPTION_CANCEL
|
||||
@@ -954,8 +954,12 @@ gpt_read (PedDisk *disk)
|
||||
write_back = 0;
|
||||
break;
|
||||
}
|
||||
-#endif /* !DISCOVER_ONLY */
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ write_back = 0;
|
||||
+ }
|
||||
+#endif /* !DISCOVER_ONLY */
|
||||
gpt = primary_gpt;
|
||||
pth_free (backup_gpt);
|
||||
}
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index 7bfb22e..38922f6 100644
|
||||
--- a/tests/Makefile.in
|
||||
+++ b/tests/Makefile.in
|
||||
@@ -9,6 +9,7 @@ TESTS = \
|
||||
t0200-gpt.sh \
|
||||
t0201-gpt.sh \
|
||||
t0202-gpt-pmbr.sh \
|
||||
+ t0205-gpt-list-clobbers-pmbr.sh \
|
||||
t0220-gpt-msftres.sh \
|
||||
t0250-gpt.sh \
|
||||
t0280-gpt-corrupt.sh \
|
||||
@@ -1261,6 +1261,8 @@ t0201-gpt.sh.log: t0201-gpt.sh
|
||||
@p='t0201-gpt.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
|
||||
t0202-gpt-pmbr.sh.log: t0202-gpt-pmbr.sh
|
||||
@p='t0202-gpt-pmbr.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
|
||||
+t0205-gpt-list-clobbers-pmbr.sh.log: t0205-gpt-list-clobbers-pmbr.sh
|
||||
+ @p='t0205-gpt-list-clobbers-pmbr.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
|
||||
t0220-gpt-msftres.sh.log: t0220-gpt-msftres.sh
|
||||
@p='t0220-gpt-msftres.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
|
||||
t0250-gpt.sh.log: t0250-gpt.sh
|
||||
diff --git a/tests/t0205-gpt-list-clobbers-pmbr.sh b/tests/t0205-gpt-list-clobbers-pmbr.sh
|
||||
new file mode 100644
|
||||
index 0000000..979a15e
|
||||
--- /dev/null
|
||||
+++ b/tests/t0205-gpt-list-clobbers-pmbr.sh
|
||||
@@ -0,0 +1,59 @@
|
||||
+#!/bin/sh
|
||||
+# Ensure that printing a GPT partition table does not modify the pMBR.
|
||||
+# Due to a bug in parted-2.1, "parted /dev/... print" would do just that.
|
||||
+# Not a problem for most, but if you have a hybrid, e.g., gptsync'd
|
||||
+# GPT/MBR table, merely listing the table with Parted-2.1 would clobber
|
||||
+# the MBR part.
|
||||
+
|
||||
+# Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if test "$VERBOSE" = yes; then
|
||||
+ set -x
|
||||
+ parted --version
|
||||
+fi
|
||||
+
|
||||
+: ${srcdir=.}
|
||||
+. $srcdir/t-lib.sh
|
||||
+
|
||||
+fail=0
|
||||
+
|
||||
+ss=$sector_size_
|
||||
+n_sectors=400
|
||||
+dev=dev-file
|
||||
+
|
||||
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
|
||||
+parted -s $dev mklabel gpt || fail=1
|
||||
+parted -s $dev mkpart p1 101s 150s || fail=1
|
||||
+parted -s $dev mkpart p2 151s 200s || fail=1
|
||||
+parted -s $dev mkpart p3 201s 250s || fail=1
|
||||
+
|
||||
+parted -m -s $dev u s p || fail=1
|
||||
+
|
||||
+# Write non-NUL bytes all over the MBR, so we're likely to see any change.
|
||||
+# However, be careful to leave the type of the first partition, 0xEE,
|
||||
+# as well as the final two magic bytes.
|
||||
+printf '%0450d\xee%059d\x55\xaa' 0 0 | dd of=$dev count=1 conv=notrunc || fail=1
|
||||
+
|
||||
+dd if=$dev of=before count=1 || fail=1
|
||||
+
|
||||
+chmod a-w $dev
|
||||
+parted -m -s $dev u s p || fail=1
|
||||
+
|
||||
+dd if=$dev of=after count=1 || fail=1
|
||||
+
|
||||
+cmp before after || fail=1
|
||||
+
|
||||
+Exit $fail
|
||||
--
|
||||
1.6.6
|
||||
|
@ -1,158 +0,0 @@
|
||||
From 358c9846a014247605d8da47b6917cac1344de00 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Meyering <meyering@redhat.com>
|
||||
Date: Fri, 15 Jan 2010 20:14:38 +0100
|
||||
Subject: [PATCH] dos: don't leak a constraint upon partition-add failure
|
||||
|
||||
* libparted/labels/dos.c (read_table): Free constraint upon failure.
|
||||
---
|
||||
libparted/labels/dos.c | 9 +++++----
|
||||
1 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
|
||||
index 6b8d6cb..339acf4 100644
|
||||
--- a/libparted/labels/dos.c
|
||||
+++ b/libparted/labels/dos.c
|
||||
@@ -873,7 +873,6 @@ read_table (PedDisk* disk, PedSector sector, int is_extended_table)
|
||||
PedPartition* part;
|
||||
PedPartitionType type;
|
||||
PedSector lba_offset;
|
||||
- PedConstraint* constraint_exact;
|
||||
|
||||
PED_ASSERT (disk != NULL, return 0);
|
||||
PED_ASSERT (disk->dev != NULL, return 0);
|
||||
@@ -944,10 +943,12 @@ read_table (PedDisk* disk, PedSector sector, int is_extended_table)
|
||||
if (type != PED_PARTITION_EXTENDED)
|
||||
part->fs_type = ped_file_system_probe (&part->geom);
|
||||
|
||||
- constraint_exact = ped_constraint_exact (&part->geom);
|
||||
- if (!ped_disk_add_partition (disk, part, constraint_exact))
|
||||
- goto error;
|
||||
+ PedConstraint *constraint_exact
|
||||
+ = ped_constraint_exact (&part->geom);
|
||||
+ bool ok = ped_disk_add_partition (disk, part, constraint_exact);
|
||||
ped_constraint_destroy (constraint_exact);
|
||||
+ if (!ok)
|
||||
+ goto error;
|
||||
|
||||
/* non-nested extended partition */
|
||||
if (part->type == PED_PARTITION_EXTENDED) {
|
||||
--
|
||||
1.6.3.3
|
||||
|
||||
From d0cec198183be0b9989e4bc729c2930c7cdfe545 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Meyering <meyering@redhat.com>
|
||||
Date: Fri, 15 Jan 2010 19:53:36 +0100
|
||||
Subject: [PATCH] gpt: don't leak a constraint upon partition-add failure
|
||||
|
||||
* libparted/labels/gpt.c (gpt_read): Free constraint upon failure.
|
||||
---
|
||||
libparted/labels/gpt.c | 4 ++--
|
||||
1 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
|
||||
index 76537fd..9d9876c 100644
|
||||
--- a/libparted/labels/gpt.c
|
||||
+++ b/libparted/labels/gpt.c
|
||||
@@ -1020,7 +1020,6 @@ gpt_read (PedDisk *disk)
|
||||
GuidPartitionEntry_t *pte
|
||||
= (GuidPartitionEntry_t *) ((char *) ptes + i * p_ent_size);
|
||||
PedPartition *part;
|
||||
- PedConstraint *constraint_exact;
|
||||
|
||||
if (!guid_cmp (pte->PartitionTypeGuid, UNUSED_ENTRY_GUID))
|
||||
continue;
|
||||
@@ -1032,9 +1031,10 @@ gpt_read (PedDisk *disk)
|
||||
part->fs_type = ped_file_system_probe (&part->geom);
|
||||
part->num = i + 1;
|
||||
|
||||
- constraint_exact = ped_constraint_exact (&part->geom);
|
||||
+ PedConstraint *constraint_exact = ped_constraint_exact (&part->geom);
|
||||
if (!ped_disk_add_partition (disk, part, constraint_exact))
|
||||
{
|
||||
+ ped_constraint_destroy (constraint_exact);
|
||||
ped_partition_destroy (part);
|
||||
goto error_delete_all;
|
||||
}
|
||||
--
|
||||
1.6.3.3
|
||||
|
||||
From 952e4919befce199b096fd1bbde93ef7902239d3 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Meyering <meyering@redhat.com>
|
||||
Date: Fri, 15 Jan 2010 19:34:00 +0100
|
||||
Subject: [PATCH] gpt: do not leak a GPT header on an error path
|
||||
|
||||
* libparted/labels/gpt.c (gpt_write): Avoid a leak by freeing the
|
||||
header buffer after pth_get_raw call where it's used, but before
|
||||
checking whether that pth_get_raw call succeeded.
|
||||
Avoid another leak in identical just 10 lines down.
|
||||
Add "FIXME: caution..." comments to warn about the duplication.
|
||||
---
|
||||
libparted/labels/gpt.c | 12 ++++++++----
|
||||
1 files changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
|
||||
index fe1f300..76537fd 100644
|
||||
--- a/libparted/labels/gpt.c
|
||||
+++ b/libparted/labels/gpt.c
|
||||
@@ -1208,11 +1208,13 @@ gpt_write (const PedDisk *disk)
|
||||
goto error_free_ptes;
|
||||
|
||||
/* Write PTH and PTEs */
|
||||
+ /* FIXME: Caution: this code is nearly identical to what's just below. */
|
||||
if (_generate_header (disk, 0, ptes_crc, &gpt) != 0)
|
||||
goto error_free_ptes;
|
||||
- if ((pth_raw = pth_get_raw (disk->dev, gpt)) == NULL)
|
||||
- goto error_free_ptes;
|
||||
+ pth_raw = pth_get_raw (disk->dev, gpt);
|
||||
pth_free (gpt);
|
||||
+ if (pth_raw == NULL)
|
||||
+ goto error_free_ptes;
|
||||
int write_ok = ped_device_write (disk->dev, pth_raw, 1, 1);
|
||||
free (pth_raw);
|
||||
if (!write_ok)
|
||||
@@ -1222,11 +1224,13 @@ gpt_write (const PedDisk *disk)
|
||||
goto error_free_ptes;
|
||||
|
||||
/* Write Alternate PTH & PTEs */
|
||||
+ /* FIXME: Caution: this code is nearly identical to what's just above. */
|
||||
if (_generate_header (disk, 1, ptes_crc, &gpt) != 0)
|
||||
goto error_free_ptes;
|
||||
- if ((pth_raw = pth_get_raw (disk->dev, gpt)) == NULL)
|
||||
- goto error_free_ptes;
|
||||
+ pth_raw = pth_get_raw (disk->dev, gpt);
|
||||
pth_free (gpt);
|
||||
+ if (pth_raw == NULL)
|
||||
+ goto error_free_ptes;
|
||||
write_ok = ped_device_write (disk->dev, pth_raw, disk->dev->length - 1, 1);
|
||||
free (pth_raw);
|
||||
if (!write_ok)
|
||||
--
|
||||
1.6.3.3
|
||||
|
||||
From 19b072592a7a551a861c200be58aef04a7546fb9 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Meyering <meyering@redhat.com>
|
||||
Date: Fri, 15 Jan 2010 18:56:37 +0100
|
||||
Subject: [PATCH] libparted: avoid double-free on an OOM failure path
|
||||
|
||||
* libparted/disk.c (ped_disk_check): Don't double-free "fs_size".
|
||||
---
|
||||
libparted/disk.c | 2 ++
|
||||
1 files changed, 2 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/libparted/disk.c b/libparted/disk.c
|
||||
index c14d005..2d27b7c 100644
|
||||
--- a/libparted/disk.c
|
||||
+++ b/libparted/disk.c
|
||||
@@ -632,7 +632,9 @@ ped_disk_check (const PedDisk* disk)
|
||||
walk->num, part_size, fs_size);
|
||||
|
||||
free (part_size);
|
||||
+
|
||||
free (fs_size);
|
||||
+ fs_size = NULL;
|
||||
|
||||
if (choice != PED_EXCEPTION_IGNORE)
|
||||
return 0;
|
||||
--
|
||||
1.6.3.3
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 38fe6955c11a8bbcdda050401f46abe25dced000 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Thu, 18 Feb 2010 14:24:32 +0100
|
||||
Subject: [PATCH parted] libparted: copy needs_clobber value in ped_disk_duplicate()
|
||||
|
||||
Most duplicate disk_ops use ped_disk_new_fresh, which sets needs_clobber
|
||||
to 1. This would lead to clobbering the disk when committing a duplicate
|
||||
disk even when the original disk was not made with ped_disk_new_fresh.
|
||||
* libparted/disk.c (ped_disk_duplicate): copy needs_clobber value.
|
||||
---
|
||||
libparted/disk.c | 3 +++
|
||||
1 files changed, 3 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/libparted/disk.c b/libparted/disk.c
|
||||
index b819d59..fc5ef17 100644
|
||||
--- a/libparted/disk.c
|
||||
+++ b/libparted/disk.c
|
||||
@@ -276,6 +276,9 @@ ped_disk_duplicate (const PedDisk* old_disk)
|
||||
}
|
||||
if (!_disk_pop_update_mode (new_disk))
|
||||
goto error_destroy_new_disk;
|
||||
+
|
||||
+ new_disk->needs_clobber = old_disk->needs_clobber;
|
||||
+
|
||||
return new_disk;
|
||||
|
||||
error_destroy_new_disk:
|
||||
--
|
||||
1.7.0
|
||||
|
22
parted.spec
22
parted.spec
@ -3,19 +3,13 @@
|
||||
|
||||
Summary: The GNU disk partition manipulation program
|
||||
Name: parted
|
||||
Version: 2.1
|
||||
Release: 5%{?dist}
|
||||
Version: 2.2
|
||||
Release: 1%{?dist}
|
||||
License: GPLv3+
|
||||
Group: Applications/System
|
||||
URL: http://www.gnu.org/software/parted
|
||||
|
||||
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
|
||||
Patch1: parted-2.1-blkid_topology_get_physical_sector_size.patch
|
||||
Patch2: parted-2.1-mem-leak-fixes-rh556012.patch
|
||||
Patch3: parted-2.1-default-alignment.patch
|
||||
Patch4: parted-2.1-gpt-clobber-pmbr-rh563211.patch
|
||||
Patch5: parted-2.1-dasd-NULL-dereference-rh563419.patch
|
||||
Patch6: parted-2.1-needs_clobber-rh566181.patch
|
||||
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: e2fsprogs-devel
|
||||
@ -55,12 +49,6 @@ Parted library, you need to install this package.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS
|
||||
|
||||
|
||||
@ -125,7 +113,7 @@ fi
|
||||
%{_sbindir}/partprobe
|
||||
%{_mandir}/man8/parted.8.gz
|
||||
%{_mandir}/man8/partprobe.8.gz
|
||||
%{_libdir}/libparted-*.so.*
|
||||
%{_libdir}/libparted.so.*
|
||||
%{_infodir}/parted.info.gz
|
||||
|
||||
%files devel
|
||||
@ -136,6 +124,10 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Mar 30 2010 Hans de Goede <hdegoede@redhat.com> 2.2-1
|
||||
- New upstream version 2.2 (#577478)
|
||||
- Drop all our patches (all upstreamed)
|
||||
|
||||
* Thu Feb 18 2010 Hans de Goede <hdegoede@redhat.com> 2.1-5
|
||||
- Copy needs_clobber value in ped_disk_duplicate() (#561976)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user