From 34da790ef30a2bdb30932cbfd9c67fe61f6014d8 Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Sun, 3 Mar 2013 13:04:02 -0700 Subject: [PATCH] Fix move partition right to left shrinks partition 1 MiB (#695078) When moving a MiB aligned primary partition from right to left, the resulting partition was unexpectedly 1 MiB smaller in size. From further testing, this occurred only if the move boundaries overlapped the original partition boundaries. In cases where the move did not overlap the original partition boundaries, then the size remained the same. Closes Bug #695078 - Move of MiB aligned partition right to left yields unexpected shrink of 1 MiB --- src/GParted_Core.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index 7a4dd862..fd8eaa94 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -550,6 +550,12 @@ bool GParted_Core::snap_to_mebibyte( const Device & device, Partition & partitio if ( ( device .partitions[ t ] .type == TYPE_PRIMARY || device .partitions[ t ] .type == TYPE_EXTENDED ) + && ( //For a change to an existing partition, (e.g., move or resize) + // skip comparing to original partition and + // only compare to other existing partitions + partition .status == STAT_REAL + && partition .partition_number != device. partitions[ t ] .partition_number + ) && ( device .partitions[ t ] .sector_start > partition .sector_start ) && ( device .partitions[ t ] .sector_start <= partition .sector_end ) )