bugGNU GRUB - Bugs: bug #38035, Off by one error in enumerating...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

bug #38035: Off by one error in enumerating MSDOS partitions

Submitted by:  Andrei Borzenkov <arvidjaar>
Submitted on:  Mon Jan 7 14:24:39 2013  
 
Category: Disk & PartitionSeverity: Major
Priority: 5 - NormalItem Group: Software Error
Status: FixedPrivacy: Public
Assigned to: NoneOriginator Name: 
Open/Closed: ClosedRelease: 
Release: Bazaar - trunkReproducibility: Every Time
Planned Release: None

(Jump to the original submission Jump to the original submission)

Wed Feb 27 09:01:39 2013, comment #6:

Well doesn't look like OpenSuSe is going to solve their bugs but w/e it's their problems. I apply here only the fix for smaller problem.

Vladimir Serbinenko <phcoder>
Project Administrator
Wed Jan 9 21:31:13 2013, comment #5:

I will commit the patch but I want first to be sure that bigger problem behind this patch is adressed. There are other cases when the numbering doesn't match e.g. in presence of solaris or BSD partitions.

Vladimir Serbinenko <phcoder>
Project Administrator
Wed Jan 9 21:27:53 2013, comment #4:

So while there is a cosmetic problem in GRUB, the real problem is that yast uses 'hdX,Y' rather than giving device.

Vladimir Serbinenko <phcoder>
Project Administrator
Wed Jan 9 21:25:26 2013, comment #3:

And never call grub-install with '(hd0,X)' notation. It's wrong and if it still works it would be because nobody cared to remove it.

Vladimir Serbinenko <phcoder>
Project Administrator
Wed Jan 9 21:23:59 2013, comment #2:

And please remove --skip-fs-probe. It's not intended to be used automatically. It's only after huan intervention and check that it can be used or you risk overwriting data.

Vladimir Serbinenko <phcoder>
Project Administrator
Wed Jan 9 21:10:57 2013, comment #1:

Why and where do you rely on partition numbers at all? They are not guaranteed to match Linux or any other OS numbering scheme.

Vladimir Serbinenko <phcoder>
Project Administrator
Mon Jan 7 14:24:39 2013, original submission:

As reported in https://bugzilla.novell.com/show_bug.cgi?id=779534#c19 under some conditions GRUB2 includes extended partition in total partition numbering causing wrong numbers to be assigned. This happens under following conditions

- extended primary partition exists
- the very first next extended boot record has extended partition as the first entry (usually first entry points to normal partition)

Depending on number of primary partitions, it could also possibly happen for next EBR as well.

Full partitions dump is available as https://bugzilla.novell.com/attachment.cgi?id=519076

The reason is off by one error in grub_partition_msdos_iterate(). p.number starts counting partitions with 0, so primary partitions have number 0..3 and at the point p.number is incremented it still points to previous partition. So it should be p.number < 3 to apply to primary partitions only.

Patch against trunk attached. It is confirmed as working by original reporter.

Andrei Borzenkov <arvidjaar>
Project Member

 

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by phcoder (Posted a comment)
  • -unavailable- added by arvidjaar (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed Feb 27 09:01:39 2013phcoderStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Mon Jan 7 14:24:39 2013arvidjaarAttached File-=>Added grub2-fix-enumeration-of-extended-partition.patch, #27215

    Back to the top


    Powered by Savane 3.1-cleanup