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

 
 

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

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

Submitter:  Andrei Borzenkov <arvidjaar>
Submitted:  Mon 07 Jan 2013 02:24:39 PM UTC
   
 
Category:  Disk & Partition Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  Fixed Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Closed Release:  Bazaar - trunk
Release:  Reproducibility:  Every Time
Planned Release:  None

Jump to the original submission

Wed 27 Feb 2013 09:01:39 AM UTC, 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>
Group administrator
Wed 09 Jan 2013 09:31:13 PM UTC, 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>
Group administrator
Wed 09 Jan 2013 09:27:53 PM UTC, 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>
Group administrator
Wed 09 Jan 2013 09:25:26 PM UTC, 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>
Group administrator
Wed 09 Jan 2013 09:23:59 PM UTC, 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>
Group administrator
Wed 09 Jan 2013 09:10:57 PM UTC, 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>
Group administrator
Mon 07 Jan 2013 02:24:39 PM UTC, 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>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-02-27 phcoder StatusNone Fixed
        Open/ClosedOpen Closed
    2013-01-07 arvidjaar Attached File- Added grub2-fix-enumeration-of-extended-partition.patch, #27215

    Back to the top

    Powered by Savane 3.15-e6e5.
    Corresponding source code