From aec564f1a2005b8c92a85da556bbec51df452e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Wed, 18 May 2016 13:13:51 +0100 Subject: [PATCH] Disable OperationStack merging of operations for luks partitions. --- src/core/operationstack.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/core/operationstack.cpp b/src/core/operationstack.cpp index b1a6d9d..c76d31b 100644 --- a/src/core/operationstack.cpp +++ b/src/core/operationstack.cpp @@ -68,15 +68,15 @@ OperationStack::~OperationStack()
  • An existing operation created a Partition that is now being deleted: In this case, just remove the corresponding NewOperation from the OperationStack.
    This does not work for - extended partitions.(#232092)
  • + extended partitions (#232092) and luks partitions.
  • An existing Operation created a Partition that is now being moved or resized. In this case, remove the original NewOperation and create a new NewOperation with updated start and end sectors. This new NewOperation is appended to the OperationStack.
    This does not work for - extended partitions.(#232092)
  • + extended partitions(#232092) and luks partitions.
  • An existing NewOperation created a Partition that is now being copied. We're not copying - but instead creating another new Partition in its place.
  • + but instead creating another new Partition in its place. This does not work for luks partitions.
  • The label for a new Partition's FileSystem is modified: Modify in NewOperation and forget it.
  • @@ -105,7 +105,9 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed CheckOperation* pushedCheckOp = dynamic_cast(pushedOp); // -- 1 -- - if (pushedDeleteOp && &newOp->newPartition() == &pushedDeleteOp->deletedPartition() && !pushedDeleteOp->deletedPartition().roles().has(PartitionRole::Extended)) { + if (pushedDeleteOp && &newOp->newPartition() == &pushedDeleteOp->deletedPartition() && + !pushedDeleteOp->deletedPartition().roles().has(PartitionRole::Extended) && + !pushedDeleteOp->deletedPartition().roles().has(PartitionRole::Luks)) { Log() << i18nc("@info/plain", "Deleting a partition just created: Undoing the operation to create the partition."); delete pushedOp; @@ -118,7 +120,9 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed } // -- 2 -- - if (pushedResizeOp && &newOp->newPartition() == &pushedResizeOp->partition() && !pushedResizeOp->partition().roles().has(PartitionRole::Extended)) { + if (pushedResizeOp && &newOp->newPartition() == &pushedResizeOp->partition() && + !pushedResizeOp->partition().roles().has(PartitionRole::Extended) && + !pushedResizeOp->partition().roles().has(PartitionRole::Luks)) { // NOTE: In theory it would be possible to merge resizing an extended as long as it has no children. // But that still doesn't save us: If we're not merging a resize on an extended that has children, // a resizeop is added to the stack. Next, the user deletes the child. Then he resizes the @@ -143,7 +147,8 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed } // -- 3 -- - if (pushedCopyOp && &newOp->newPartition() == &pushedCopyOp->sourcePartition()) { + if (pushedCopyOp && &newOp->newPartition() == &pushedCopyOp->sourcePartition() && + !pushedCopyOp->sourcePartition().roles().has(PartitionRole::Luks)) { Log() << i18nc("@info/plain", "Copying a new partition: Creating a new partition instead."); Partition* newPartition = new Partition(newOp->newPartition());