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 <i27...@gmail.com> 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 <i27...@gmail.com> 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:

  http://git.debian.org/?p=parted/parted.git

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 <matt_dom...@dell.com>
     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.  */
+#ifndef DISCOVER_ONLY
       if (PED_LE64_TO_CPU (primary_gpt->AlternateLBA) < disk->dev->length - 1)
         {
-#ifndef DISCOVER_ONLY
           switch (ped_exception_throw
                   (PED_EXCEPTION_ERROR,
                    (PED_EXCEPTION_FIX | PED_EXCEPTION_CANCEL
@@ -954,8 +954,12 @@ gpt_read (PedDisk *disk)
               write_back = 0;
               break;
             }
-#endif /* !DISCOVER_ONLY */
         }
+      else
+       {
+         write_back = 0;
+       }
+#endif /* !DISCOVER_ONLY */
       gpt = primary_gpt;
       pth_free (backup_gpt);
     }


_______________________________________________
bug-parted mailing list
bug-parted@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-parted

Reply via email to