[gparted] Fix failing operations following paste into existing partition (#746559)
- From: Mike Fleetwood <mfleetwo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Fix failing operations following paste into existing partition (#746559)
- Date: Thu, 26 Mar 2015 20:33:23 +0000 (UTC)
commit d9993c21ba2f78cd1a1e64d7d5fafb17e73f9f81
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sun Mar 22 16:05:40 2015 +0000
Fix failing operations following paste into existing partition (#746559)
Format, label file system and new UUID operations would fail when
applied in a sequence to the destination partition following a previous
copy-paste operation.
Giving the copy of a file system a new label and a new UUID are the sort
of actions which should be performed when the disk containing the copy
remains attached to the same computer. This really should work.
Fragment of the failing operation details for a copy and label operation
sequence:
+ Copy /dev/sdb1 to /dev/sdb2
+ calibrate /dev/sdb2
+ calibrate copy of /dev/sdb1
+ calibrate /dev/sdb1
+ check the file system on /dev/sdb1 for errors and (if possible fix them
+ copy file system of /dev/sdb1 to /dev/sdb2
+ Set file system label "small-dst" on copy of /dev/sdb1
+ calibrate copy of /dev/sdb1
path: /dev/sdb2 (partition)
...
+ set file system label to "small-dst" on copy of /dev/sdb1
+ e2label copy of /dev/sdb1 "small-dst"
Usage: e2label device [newlabel]
This is failing because the file system specific command is passed
"copy of /dev/sdb1" as the device name. Code sequence:
1) OperationCopy::OperationCopy() sets the real path name of the
partition_new object to "copy of /dev/SRC" for display purposes.
2) GParted_Core::apply_operation_to_disk() calls calibrate_partition()
on partition_original object, restoring the real path name for
object partition_original.
3) apply_operation_to_disk() calls format(), label_filesystem() or
change_uuid() on the partition_new object, which still has the real
path name set to "copy of /dev/SRC". File system specific commands
fail with this as a path name.
Fix by copying the real path name from object partition_original to
partition_new, as is already done for the resize/move operation. Also
apply this fix to the name partition operation, because it uses the
partition_new object and so that it displays the real path name in the
operation details.
Bug 746559 - Various operations fail when following paste into existing
partition
src/GParted_Core.cc | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 77438be..8a8faf9 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -764,6 +764,8 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation )
operation ->operation_detail );
break ;
case OPERATION_FORMAT:
+ // Reset real path in case the name is "copy of ..." from previous operation
+ operation->partition_new.add_path( operation->partition_original.get_path(),
true );
succes = remove_filesystem( operation ->partition_original, operation
->operation_detail ) &&
format( operation ->partition_new, operation ->operation_detail ) ;
break ;
@@ -782,12 +784,18 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation )
operation ->operation_detail ) ;
break ;
case OPERATION_LABEL_FILESYSTEM:
+ // Reset real path in case the name is "copy of ..." from previous operation
+ operation->partition_new.add_path( operation->partition_original.get_path(),
true );
succes = label_filesystem( operation->partition_new,
operation->operation_detail );
break ;
case OPERATION_NAME_PARTITION:
+ // Reset real path in case the name is "copy of ..." from previous operation
+ operation->partition_new.add_path( operation->partition_original.get_path(),
true );
succes = name_partition( operation->partition_new,
operation->operation_detail );
break;
case OPERATION_CHANGE_UUID:
+ // Reset real path in case the name is "copy of ..." from previous operation
+ operation->partition_new.add_path( operation->partition_original.get_path(),
true );
succes = change_uuid( operation ->partition_new, operation ->operation_detail
) ;
break ;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]