Bug 234708

Summary: gptboot prompt only supports first nine partitions
Product: Base System Reporter: Ian Lepore <ian>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Some People    
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Ian Lepore freebsd_committer freebsd_triage 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.