summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-03-03 13:04:49 +0000
committerAlyssa Ross <hi@alyssa.is>2022-03-22 21:18:12 +0000
commitad874f4d2a73fde67bc023190020428be668dbcf (patch)
tree9c85b54586f91fe0e89076903100903f89019f85
parent37437c6eb0885057cbadcf40aa4cb03d5be1a76a (diff)
downloadnixpkgs-ad874f4d2a73fde67bc023190020428be668dbcf.tar
nixpkgs-ad874f4d2a73fde67bc023190020428be668dbcf.tar.gz
nixpkgs-ad874f4d2a73fde67bc023190020428be668dbcf.tar.bz2
nixpkgs-ad874f4d2a73fde67bc023190020428be668dbcf.tar.lz
nixpkgs-ad874f4d2a73fde67bc023190020428be668dbcf.tar.xz
nixpkgs-ad874f4d2a73fde67bc023190020428be668dbcf.tar.zst
nixpkgs-ad874f4d2a73fde67bc023190020428be668dbcf.zip
linux.configfile: fix alts containing "/m"
generate-config.pl's auto modules feature answers "m" to any Kconfig
question it thinks supports being a module.  It detected this by
seeing if the help shown by make config (called "alts" by the script)
contained the string "/m", which it would in the case of e.g a
tristate option, where alts would be "N/m/y/?".

But then along came CONFIG_MODPROBE_PATH in Linux 5.13, with a default
value, shown in the make config help, of "/sbin/modprobe".
generate-config.pl would see the "/m" substring, and answer "m" to the
question, meaning (I think) that the built kernel would expect the
modprobe binary to be at /m.  This broke the (non-NixOS) VM images I
build with Nix.  NixOS was unaffected because it uses a different
mechanism to set the modprobe path.

With the current architecture, we can't 100% determine whether a
Kconfig option is a string or a tristate, but we can get a lot closer
by using a better regex.  My new regex only accepts single word
characters, separated by slashes, with a "/?" at the end.  This is
much less likely to ever end up as the default value of a string
option.

Tested by building linux_latest.configfile before and after my
changes, and checking the only difference is the correct default for
CONFIG_MODPROBE_PATH.
-rw-r--r--pkgs/os-specific/linux/kernel/generate-config.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/kernel/generate-config.pl b/pkgs/os-specific/linux/kernel/generate-config.pl
index df807188f14..7e12ca5d96a 100644
--- a/pkgs/os-specific/linux/kernel/generate-config.pl
+++ b/pkgs/os-specific/linux/kernel/generate-config.pl
@@ -81,7 +81,7 @@ sub runConfig {
                 my $question = $1; my $name = $2; my $alts = $3;
                 my $answer = "";
                 # Build everything as a module if possible.
-                $answer = "m" if $autoModules && $alts =~ /\/m/ && !($preferBuiltin && $alts =~ /Y/);
+                $answer = "m" if $autoModules && $alts =~ qr{\A(\w/)+m/(\w/)*\?\z} && !($preferBuiltin && $alts =~ /Y/);
                 $answer = $answers{$name} if defined $answers{$name};
                 print STDERR "QUESTION: $question, NAME: $name, ALTS: $alts, ANSWER: $answer\n" if $debug;
                 print OUT "$answer\n";