git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit16c0697e6822b360c3f538fcd443046ea3f3b6fc authorLinus Heckemann <git@sphalerite.org> dateSat 19 Dec 2020, 01:44 (6 years ago) parent1db8a43
1 file changed+6
pkgs/os-specific/linux/kernel/generate-config.pl+6
pkgs/os-specific/linux/kernel/generate-config.pl+6
@@ -61,6 +61,12 @@ sub runConfig {
6161 # Remember choice alternatives ("> 1. bla (FOO)" or " 2. bla (BAR) (NEW)").
6262 if ($line =~ /^\s*>?\s*(\d+)\.\s+.*?\(([A-Za-z0-9_]+)\)(?:\s+\(NEW\))?\s*$/) {
6363 $choices{$2} = $1;
64+ } else {
65+ # The list of choices has ended without us being
66+ # asked. This happens for options where only one value
67+ # is valid, for instance. The results can foul up
68+ # later options, so forget about it.
69+ %choices = ();
6470 }
6571
6672 $line = "";