[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: assertion PED_LE64_TO_CPU (gpt->AlternateLBA) <= disk->dev->length f
From: |
Joel Granados |
Subject: |
Re: assertion PED_LE64_TO_CPU (gpt->AlternateLBA) <= disk->dev->length failed |
Date: |
Tue, 11 Nov 2008 10:18:59 -0500 (EST) |
Hey list:
This message seems ok to me. While I look at the patch I ask myself if it would
not be better a PED_EXCEPTION_ERROR instead of the warning. And, moreover,
what occurs if the user selects ignore as apposed to cancel?
Additionally a test case here would be *great* but how do you actually make the
gpt table point to a point that is farther away than the device. mmmm. maybe
creating a label in a device with X size, then copying the first blocks to a
device that is smaller than the other. and then executing some parted command.
Regards
----- "Petr Uzel" <address@hidden> wrote:
> On Tue, Aug 26, 2008 at 12:27:21PM -0600, Bjorn Helgaas wrote:
> > > Yes, that is probably the root of the problem.
> > > The assertion is Parted's way of warning you that your
> > > disk/partition table is corrupted in a surprising/unusual way.
> > > Can you suggest a better way to handle this sort of failure?
> >
> > My preference would be:
> >
> > - Since there's a valid GPT at the beginning of the image, and
> only
> > the secondary copy is missing, warn that the secondary copy is
> > missing or corrupted and continue.
>
> What about this fix? Just a proposal...
>
> From c44a42e6a15388bf87de873fbca07796c0139b69 Mon Sep 17 00:00:00
> 2001
> From: Petr Uzel <address@hidden>
> Date: Wed, 5 Nov 2008 10:17:07 +0100
> Subject: [PATCH] print warning instead of crash on corrupted GPT
>
> ---
> libparted/labels/gpt.c | 14 ++++++++++++--
> 1 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
> index 13d2e88..c20d729 100644
> --- a/libparted/labels/gpt.c
> +++ b/libparted/labels/gpt.c
> @@ -824,8 +824,18 @@ gpt_read (PedDisk * disk)
> goto error;
>
> if (_read_header (disk->dev, &gpt, 1)) {
> - PED_ASSERT ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
> - <= disk->dev->length - 1, goto error_free_gpt);
> + if ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
> + > disk->dev->length - 1) {
> + if (ped_exception_throw (
> + PED_EXCEPTION_WARNING,
> + PED_EXCEPTION_IGNORE_CANCEL,
> + _("The primary GPT table states that the backup GPT table is "
> + "located at the position that is beyond the end of the disk. "
> + "This means that the GPT structure is corrupted."))
> + == PED_EXCEPTION_CANCEL)
> + goto error_free_gpt;
> + }
> +
> if ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
> < disk->dev->length - 1) {
> char* zeros = ped_malloc (pth_get_size (disk->dev));
> --
> 1.6.0.2
>
>
> --
> Best regards / s pozdravem
>
> Petr Uzel, Packages maintainer
> ---------------------------------------------------------------------
> SUSE LINUX, s.r.o. e-mail: address@hidden
> Lihovarská 1060/12 tel: +420 284 028 964
> 190 00 Prague 9 fax: +420 284 028 951
> Czech Republic http://www.suse.cz
>
>
> _______________________________________________
> bug-parted mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-parted
--
Joel Andres Granados
Red Hat / Brno Czech Republic
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: assertion PED_LE64_TO_CPU (gpt->AlternateLBA) <= disk->dev->length failed,
Joel Granados <=