[parted-devel] > 63 heads. Why does this keep coming up?
Phillip Susi
psusi at cfl.rr.com
Mon Feb 28 18:34:24 UTC 2011
On 2/28/2011 1:24 PM, Brian C. Lane wrote:
> PED_ASSERT is actually working correctly, the 2nd parameter (action)
> isn't used by the macro at all.
These two statements seem incompatible. If it is working correctly,
then it should not be ignoring arguments. If the argument is not
supposed to be used, then it should not be there.
> Looking at the code for probe_partition_for_geom() it is apparent that
> this is a bit of a complicated problem (if you have to apply matrix math
> to figure out the CHS...) so it is probably correct to throw an
> assertion -- it is indicating a failure in the algorithm to determine
> the correct values.
Failure is a perfectly acceptable outcome that should not cause a hard
abort. Some of the tests return 0 when they fail. It appears that the
tests that use PARTED_ASSERT were also supposed to return 0, which is
why that is passed as the second argument. This doesn't happen though,
because that argument is ignored, which is why I patched the tests to
not use PARTED_ASSERT.
> I've looked at the sfdisk code which seems to work, but it is much
> harder to read than parted's code, and takes a different approach (I
> think).
Sometimes it is simply not possible to solve the equation and guess what
geometry was originally used, which is why the function returns zero
when it can not do so, and parted carries on quite happily when this
happens.
> I think we've had a couple of people post their partition tables, I'm
> going to see if I can run gdb against those and figure out what is
> failing.
What is failing is that the chs values in the partition table are
garbage and so they can not be used to determine what the geometry of
the disk is. In this case, probe_partition_for_geom() is supposed to
return 0 and parted uses a default geometry.
More information about the parted-devel
mailing list