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

Bug#397973: parted: Fix mac partition table corruption

On Sat, Mar 03, 2007 at 10:01:00PM -0800, Steve Langasek wrote:
On Sat, Mar 03, 2007 at 03:25:20AM +0100, David Härdeman wrote:
>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.

Which means, AIUI, that clearing the flag is not sufficient to clear the
flag on disk, so if a user clears the flag, saves changes, closes parted (or
similar), and restarts parted, the flag will show up again, correct?

That seems suboptimal to me.

Sorry, I was confused...the code with the patch applied is:

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

So, if you clear the LVM flag, state is 0, and mac_data->is_lvm is 1, therefore mac_partition_set_system() is called which sets the system_name to "Apple_UNIX_SVR2", so the flag is really cleared on disk (and other flags are cleared on-disk as well since the system_name is changed...this is not reflected in the state of mac_data->is_*whatever*.

If you clear a non-set LVM flag, state is 0 and mac_data->is_lvm is 0, so mac_partition_set_system is not called.

David Härdeman

Reply to: