Subject: bug#17108: [PATCH 1/4] libparted: Check AlternateLBA against LBA-1

From: Phillip Susi <[email-masked]>
Date: Thu, 27 Mar 2014 20:12:08 -0400

On 03/27/2014 07:10 PM, Brian C. Lane wrote:
> I think we should remove the second prompt and only check for
> header at end of disk. When we fix the header location we should
> also be adjusting LastUsableLBA based on the disk size anyway.

We only adjust if the user says to.

> Also note that the existing calculations for the backup partition
> table entries are relative to AlternateLBA, not LastUsableLBA. In
> practice when parted operates on things there is no difference, but
> according to the comments in t0210 others may not do the same thing
> and there is nothing in the UEFI spec that guarantees that the PTE
> will start at LastUsableLBA+1 -- that's why the header has a
> pointer to the start of the PTE instead of just calculating it.

The goal is that if it isn't at LastUableLBA+1, then we offer to grow
the table to use the extra space, rather than complain first that the
backup is in the wrong location, and *then* offer to use the extra space.

> In summary: * I am pretty confident that my patches are correct

They completely revert the behavioral fixes of my previously applied
patches, which is why you needed the second patch to fix the other
test to check for *both* errors.

> * We may need additional changes to remove the 'do you want to
> grow' prompt. I think we probably do.

It is the wrong location prompt that we don't want to get when the
disk has grown.  See the patch I just posted; it fixes the table
resize test without breaking anything else.