Package: parted / 3.2-7

align-new-partitions-on-fresh-disks.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From 18a51e33dce2fb187b95b70b4d0856828cfd0b48 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 6 Aug 2014 16:07:28 +0200
Subject: Align new partitions created on fresh disks

Commit fa815ad05db248d78ef214ea79a78c22772a9ffe arranged to skip
partition alignment while reading disks, but also has the effect of
skipping partition alignment when creating a partition on a fresh disk,
which is incorrect.

The proper upstream fix probably involves adding a new member to PedDisk
to keep track of whether we're in the middle of the initial read in
ped_disk_new or not.  To avoid changing ABI, we instead take this hacky
approach of overloading an extra bit on PedDisk.needs_clobber.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1352252
Forwarded: no
Last-Update: 2014-08-06

Patch-Name: align-new-partitions-on-fresh-disks.patch
---
 libparted/disk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libparted/disk.c b/libparted/disk.c
index fe82f44..60e9c44 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -195,6 +195,7 @@ ped_disk_new (PedDevice* dev)
 		goto error_close_dev;
 	}
 	disk = ped_disk_new_fresh (dev, type);
+	disk->needs_clobber |= 2;
 	if (!disk)
 		goto error_close_dev;
 	if (!type->ops->read (disk))
@@ -919,7 +920,7 @@ _partition_align (PedPartition* part, const PedConstraint* constraint)
 	PED_ASSERT (disk_type->ops->partition_align != NULL);
 	PED_ASSERT (part->disk->update_mode);
 
-	if (part->disk->needs_clobber)
+	if ((part->disk->needs_clobber & 2) != 0)
 		return 1; /* do not attempt to align partitions while reading them */
 	return disk_type->ops->partition_align (part, constraint);
 }