From 3b8cd8ad708f72f237daf05b42a956184bf2996d Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 17 Mar 2024 16:58:04 +0000 Subject: [PATCH] installer/nixos-generate-config: correctly detect bcache PR #256638 inadvertently introduced a bug in `nixos-generate-config` whereby it would never put `bcache` into the `availableKernelModules` for the initrd. This is because the `qr` operator in Perl returns a regex object, rather than matching it; the regex object evaluates to true, making the filter expression effectively `grep(!true, @bcacheDevices)`, which will always return an empty list. --- nixos/modules/installer/tools/nixos-generate-config.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index 2f9edba4f0c9..ef25b8b296e6 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -257,7 +257,7 @@ foreach my $path (glob "/sys/class/{block,mmc_host}/*") { # Add bcache module, if needed. my @bcacheDevices = glob("/dev/bcache*"); -@bcacheDevices = grep(!qr#dev/bcachefs.*#, @bcacheDevices); +@bcacheDevices = grep(!m#dev/bcachefs.*#, @bcacheDevices); if (scalar @bcacheDevices > 0) { push @initrdAvailableKernelModules, "bcache"; }