[parted-devel] Possible bug on dvh label code

David Cantrell dcantrell at redhat.com
Fri Apr 20 13:31:18 UTC 2007


On Fri, 2007-04-20 at 04:27 -0300, Otavio Salvador wrote:
> Checking what was causing the exception I started to go deeply on code
> and then found the reason but I'm not experienced at dvh labels to
> know if it's right or not.
> 
> The bug is caused by the bellow code.
> #v+
> 1  ped_disk_duplicate (const PedDisk* old_disk)
> 2  {
> 3  	PedDisk*	new_disk;
> 4  	PedPartition*	old_part;
> 5  
> 6  	PED_ASSERT (old_disk != NULL, return NULL);
> 7  	PED_ASSERT (!old_disk->update_mode, return NULL);
> 8  	PED_ASSERT (old_disk->type->ops->duplicate != NULL, return NULL);
> 9  	PED_ASSERT (old_disk->type->ops->partition_duplicate != NULL,
> 10 		    return NULL);
> 11 
> 12 	new_disk = old_disk->type->ops->duplicate (old_disk);
> 13 	if (!new_disk)
> 14 		goto error;
> 15 
> 16 	_disk_push_update_mode (new_disk);
> 17 	for (old_part = ped_disk_next_partition (old_disk, NULL); old_part;
> 18 	     old_part = ped_disk_next_partition (old_disk, old_part)) {
> 19 		if (ped_partition_is_active (old_part)) {
> 20 			if (!_add_duplicate_part (new_disk, old_part))
> 21 				goto error_destroy_new_disk;
> 22 		}
> 23 	}
> 24 	_disk_pop_update_mode (new_disk);
> 25 	return new_disk;
> 26 
> 27 error_destroy_new_disk:
> 28 	ped_disk_destroy (new_disk);
> 29 error:
> 30 	return NULL;
> 31 }
> #v-
> 
> At line 16, the code changes new_disk->update_mode and then try to
> walk through the partition table on the disk. Line 20 then fail and
> make the code goes out without reverting the update_mode change. This
> makes the exception to be raised later on ped_disk_destroy since it
> checks this value and abort.
> 
> Does someone has any tip why this specific label is failing while the
> others are not?

The dvh label is for SGI systems, so immediately the thing that comes to
mind is, "did the original account for byte ordering when writing the
dvh functionality?"

That's something to consider if you are running this on an LE system.

Also, it's entirely possible that the dvh code we have now is pretty old
in libparted and simply needs to be updated.

-- 
David Cantrell <dcantrell at redhat.com>
Red Hat / Westford, MA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20070420/4043c6a7/attachment.pgp


More information about the parted-devel mailing list