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

Bug#397973: parted: Fix mac partition table corruption

On Fri, Mar 02, 2007 at 06:14:19PM -0800, Steve Langasek wrote:
On Sat, Mar 03, 2007 at 02:47:04AM +0100, David Härdeman wrote:
diff -ur ./parted-1.7.1.orig/libparted/labels/mac.c ./parted-1.7.1/libparted/labels/mac.c
--- ./parted-1.7.1.orig/libparted/labels/mac.c	2006-05-25 19:28:55.000000000 +0200
+++ ./parted-1.7.1/libparted/labels/mac.c	2007-03-03 02:41:42.000000000 +0100
@@ -1260,19 +1260,23 @@
 		return 1;

-		mac_data->is_lvm = state;
-		if (state)
+		if (state) {
 			strcpy (mac_data->system_name, "Linux_LVM");
-		else
-			mac_partition_set_system (part, part->fs_type);
+			mac_data->is_lvm = state;
+		} else {
+			if (mac_data->is_lvm)
+				mac_partition_set_system (part, part->fs_type);
+		}
 		return 1;

So "clearing" the flag will only clear it in the internal mac_data
structure, it won't cause the system name of the partition to be reset?  Or
is this handled by mac_partition_set_system?

Yes, the system name will not be reset. clearing the flag implies nothing else than that it doesn't apply, it doesn't say what type the partition is after the flag is removed.

If we would set a default, then a partition of type foobar (without the lvm flag set) would get its system type changed if you executed "set <partnr> lvm off" in parted.

Also, I believe this is the same approach that has been taken in the later versions of the upstream package (see the source package in experimental).

David Härdeman

Reply to: