summary refs log tree commit diff
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2020-12-19 01:44:46 +0100
committerLinus Heckemann <git@sphalerite.org>2020-12-19 01:55:21 +0100
commit16c0697e6822b360c3f538fcd443046ea3f3b6fc (patch)
tree2509ed49d89a5f3c82ebb43ea07b283670b484af
parent1db8a438773d81fce7f6fee323669eda91edc821 (diff)
downloadnixpkgs-16c0697e6822b360c3f538fcd443046ea3f3b6fc.tar
nixpkgs-16c0697e6822b360c3f538fcd443046ea3f3b6fc.tar.gz
nixpkgs-16c0697e6822b360c3f538fcd443046ea3f3b6fc.tar.bz2
nixpkgs-16c0697e6822b360c3f538fcd443046ea3f3b6fc.tar.lz
nixpkgs-16c0697e6822b360c3f538fcd443046ea3f3b6fc.tar.xz
nixpkgs-16c0697e6822b360c3f538fcd443046ea3f3b6fc.tar.zst
nixpkgs-16c0697e6822b360c3f538fcd443046ea3f3b6fc.zip
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.
-rw-r--r--pkgs/os-specific/linux/kernel/generate-config.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/kernel/generate-config.pl b/pkgs/os-specific/linux/kernel/generate-config.pl
index 26c559ea908..6a2aec809a1 100644
--- a/pkgs/os-specific/linux/kernel/generate-config.pl
+++ b/pkgs/os-specific/linux/kernel/generate-config.pl
@@ -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 = "";