3
0
Fork 0
forked from mirrors/nixpkgs

linux: fix generate-config's handling of "no-choice" options

Prior to this change, the script could potentially get confused by
"menus" containing only one valid option. Thus, with

CPU_BIG_ENDIAN = no;
CPU_LITTLE_ENDIAN = yes;
ARM64_PA_BITS_48 = yes;

the endianness would be set incorrectly:

GOT: Physical address space size
GOT: > 1. 48-bit (ARM64_PA_BITS_48)
GOT: choice[1]: 1
GOT: Endianness
GOT:   1. Build big-endian kernel (CPU_BIG_ENDIAN)
GOT: > 2. Build little-endian kernel (CPU_LITTLE_ENDIAN)
CHOICE: 1-2?, ANSWER: 1

This commit fixes this error by forgetting previous menu choices if a
line that follows a menu option is neither another menu option nor the
prompt for choosing one of the options.
This commit is contained in:
Linus Heckemann 2020-12-19 01:44:46 +01:00
parent 1db8a43877
commit 16c0697e68

View file

@ -61,6 +61,12 @@ sub runConfig {
# Remember choice alternatives ("> 1. bla (FOO)" or " 2. bla (BAR) (NEW)").
if ($line =~ /^\s*>?\s*(\d+)\.\s+.*?\(([A-Za-z0-9_]+)\)(?:\s+\(NEW\))?\s*$/) {
$choices{$2} = $1;
} else {
# The list of choices has ended without us being
# asked. This happens for options where only one value
# is valid, for instance. The results can foul up
# later options, so forget about it.
%choices = ();
}
$line = "";