Bug 234708 - gptboot prompt only supports first nine partitions
Summary: gptboot prompt only supports first nine partitions
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2019-01-07 21:12 UTC by Ian Lepore
Modified: 2019-01-07 21:12 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Ian Lepore freebsd_committer 2019-01-07 21:12:48 UTC
The gptboot prompt allows overriding the default choice of disk drive and partition to load /boot/loader from.  The parser only accepts a single-digit entry for both drive number and partition number.  If you attempt to enter, for example, 0:da(0p21) it doesn't accept it; the default changes to 0:da(0p2) when the prompt is re-displayed.

The code that parses the string also tries to allow the drive number to be left off and the unit number becomes the drive number (i.e., da(5p11) would be equivelent to 5:da(0p11)), except that the code doesn't zero out the unit number after transposing it to the drive number, so you really get 5:da(5p11) which is unlikely to ever be right (this is just something I noticed while looking at parse_cmds() in gptboot.c).

I originally intended to just fix the parsing code, but then I discovered that its current behavior is undocumented (there is no mention of handling gpt partitions using a 'pNN' syntax at all, as well as no mention of reinterpreting unit number as drive number).  That means any change to this code at all might break somebody's existing configuration, and I'm just not going to open that can of worms today.