[gparted] Fix move partition right to left shrinks partition 1 MiB (#695078)



commit 34da790ef30a2bdb30932cbfd9c67fe61f6014d8
Author: Curtis Gedak <gedakc gmail com>
Date:   Sun Mar 3 13:04:02 2013 -0700

    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 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 7a4dd86..fd8eaa9 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 )
                           )


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]