Jean-Christian de Rivaz a écrit :
The first 5MB device have, acoording to parted-2.3, a cylinder size (16065) not smaller than the device length (10240), causing the PedGeometry start_geom of the function _primary_constraint() (file libparted/labels/dos.c) to stay uninitialized. I suspect that the condition "cylinder_size < dev->length" have bee introduced for the memory-mapped test as explained into the comment above the condition. Unfortunately, it seem that the true real world contain at least a type of USB key sold with a storage device that go wrong with this condition.
It seem that the only maintained source archive for GNU parted is git://git.debian.org/git/parted/parted.git . Right ? I found the this bug was introduced by this commit: commit c79d91ec71882a1673daae0482aa90c514c63cc1 Author: Jim Meyering <meyer...@redhat.com> Date: Tue Mar 30 16:50:59 2010 +0200 dos: accommodate very small devices (useful for testing) * libparted/labels/dos.c (_primary_constraint): Don't pass a negative "device_length" to ped_geometry_init when the underlying device has fewer sectors than a "cylinder". diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c index 752f186..8679c49 100644 --- a/libparted/labels/dos.c +++ b/libparted/labels/dos.c @@ -1616,8 +1616,13 @@ _primary_constraint (const PedDisk* disk, const PedCHSGeometry* bios_geom, dev->length - min_geom->end)) return NULL; } else { - if (!ped_geometry_init (&start_geom, dev, cylinder_size, - dev->length - cylinder_size)) + /* Do not assume that length is larger than 1 cylinder's + worth of sectors. This is useful when testing with + a memory-mapped "disk" (a la scsi_debug) that is say, + 2048 sectors long. */ + if (cylinder_size < dev->length + && !ped_geometry_init (&start_geom, dev, cylinder_size, + dev->length - cylinder_size)) return NULL; if (!ped_geometry_init (&end_geom, dev, 0, dev->length)) return NULL; Jean-Christian de Rivaz _______________________________________________ bug-parted mailing list bug-parted@gnu.org http://lists.gnu.org/mailman/listinfo/bug-parted