[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug with rewriting partition table - need help

From: Jim Meyering
Subject: Re: Bug with rewriting partition table - need help
Date: Sun, 07 Feb 2010 20:19:07 +0100

27/249 wrote:
> Seems that attached patch fixed this bug. I tested some cases, and
> everything works fine for me, but I'm not sure if it can break
> something hidden, so, developers, please review this fix.
> On Sun, Feb 7, 2010 at 6:50 PM, 27/249 <address@hidden> wrote:
>> Yes, I forgot to add that this bug is still present in latest GIT tree
>> (checked 1 minute ago).
>> On Sun, Feb 7, 2010 at 6:48 PM, 27/249 <address@hidden> wrote:
>>> Few weeks ago I described this bug in
>>> http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/250
>>> This bug is very serious for me, so, since I didn't see any motion in
>>> bugtracker, I wish to try to fix it myself. If you can help me in any
>>> way - it will be very good :) First of all, it will be very nice to
>>> know what piece of code can commit partition table to disk.

Thanks a lot for the report.
That appears to be a serious bug.

BTW, email to this mailing list will catch my attention,
while I rarely look at that tracker.

Would you please see if the patch below solves your problem?
It's relative to the latest in the git repo:


I want to add a test case to exercise this fix, so it'd help
if you could outline how to set up a test partition table (preferably
using only tools like dd and parted) so that merely listing triggers the bug.

diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 9d9876c..ea96a3b 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -4,7 +4,7 @@
     original version by Matt Domsch <address@hidden>
     Disclaimed into the Public Domain

-    Portions Copyright (C) 2001-2003, 2005-2009 Free Software Foundation, Inc.
+    Portions Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc.

     EFI GUID Partition Table handling
     Per Intel EFI Specification v1.02
@@ -932,9 +932,9 @@ gpt_read (PedDisk *disk)
   if (primary_gpt && backup_gpt)
       /* Both are valid.  */
       if (PED_LE64_TO_CPU (primary_gpt->AlternateLBA) < disk->dev->length - 1)
           switch (ped_exception_throw
@@ -954,8 +954,12 @@ gpt_read (PedDisk *disk)
               write_back = 0;
-#endif /* !DISCOVER_ONLY */
+      else
+       {
+         write_back = 0;
+       }
+#endif /* !DISCOVER_ONLY */
       gpt = primary_gpt;
       pth_free (backup_gpt);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]