reassign 294520 parted
tags 294520 + patch
thanks

Hi,

This is really a bug in libparted. The difference between parted and
qtparted is that qtparted uses ped_disk_duplicate() for getting a fresh
copy of the partition table. And it happends that ped_disk_duplicate()
calls ped_disk_add_partition(), which makes a lot of "bureaucracy",
including _renumbering_ through _partition_enumerate()... (and
alignment, etc...)

Here is patch for making ped_disk_duplicate() add the partition itself
in a much direct way, so as to make sure the duplicated partition is
really exactly the same as the original.

Bas Wijnen, le Wed 22 Feb 2006 11:57:08 +0100, a écrit :
> On Wed, Feb 15, 2006 at 10:21:42PM -0600, Adam Porter wrote:
> > On Friday 10 February 2006 06:46, Bas Wijnen wrote:
> > > Could you please test if the problem is solved with this patch?

The patch doesn't solve the real issue explained above.

> > Disk /dev/hdb: 120.0 GB, 120034123776 bytes
> > 16 heads, 63 sectors/track, 232581 cylinders
> 
> Perhaps the number of cylinders is the problem for parted.

That's no problem.

Samuel
--- parted-1.8.1~git1/libparted/disk.c  2006-11-17 16:44:19.000000000 +0100
+++ parted-1.8.1~git1/libparted/disk.c  2007-07-07 15:16:33.000000000 +0200
@@ -207,23 +207,24 @@ static int
 _add_duplicate_part (PedDisk* disk, PedPartition* old_part)
 {
        PedPartition*   new_part;
-       PedConstraint*  constraint_exact;
+       int ret;
 
        new_part = disk->type->ops->partition_duplicate (old_part);
        if (!new_part)
                goto error;
        new_part->disk = disk;
 
-       constraint_exact = ped_constraint_exact (&new_part->geom);
-       if (!constraint_exact)
-               goto error_destroy_new_part;
-       if (!ped_disk_add_partition (disk, new_part, constraint_exact))
-                       goto error_destroy_constraint_exact;
-       ped_constraint_destroy (constraint_exact);
+       _disk_push_update_mode (disk);
+       ret = _disk_raw_add (disk, new_part);
+       _disk_pop_update_mode (disk);
+       if (!ret)
+                       goto error_destroy_new_part;
+#ifdef DEBUG
+       if (!_disk_check_sanity (disk))
+                       goto error_destroy_new_part;
+#endif
        return 1;
 
-error_destroy_constraint_exact:
-       ped_constraint_destroy (constraint_exact);
 error_destroy_new_part:
        ped_partition_destroy (new_part);
 error:

Reply via email to