From 16c0697e6822b360c3f538fcd443046ea3f3b6fc Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Sat, 19 Dec 2020 01:44:46 +0100 Subject: 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. --- pkgs/os-specific/linux/kernel/generate-config.pl | 6 ++++++ 1 file changed, 6 insertions(+) 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 = ""; -- cgit 1.4.1