diff options
Diffstat (limited to 'debian/patches/align-new-partitions-on-fresh-disks.patch')
-rw-r--r-- | debian/patches/align-new-partitions-on-fresh-disks.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/debian/patches/align-new-partitions-on-fresh-disks.patch b/debian/patches/align-new-partitions-on-fresh-disks.patch new file mode 100644 index 0000000..c37bfe0 --- /dev/null +++ b/debian/patches/align-new-partitions-on-fresh-disks.patch @@ -0,0 +1,45 @@ +From 8b6f34acaadd78d11415144dccf5c4750e3e1d0e 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: 2023-06-26 + +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 0db7b5c9..2d6b9d49 100644 +--- a/libparted/disk.c ++++ b/libparted/disk.c +@@ -198,6 +198,7 @@ ped_disk_new (PedDevice* dev) + disk = ped_disk_new_fresh (dev, type); + if (!disk) + goto error_close_dev; ++ disk->needs_clobber |= 2; + if (!type->ops->read (disk)) + goto error_destroy_disk; + disk->needs_clobber = 0; +@@ -951,7 +952,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 || !constraint) + return 1; /* do not attempt to align partitions while reading them */ + return disk_type->ops->partition_align (part, constraint); + } |