chainlint.pl: fix incorrect CPU count on Linux SPARC
On SPARC systems running Linux, individual processors are denoted with "CPUnn:" in /proc/cpuinfo instead of the usual "processor : NN". As a result, the regexp in ncores() matches 0 times. Address this shortcoming by extending the regexp to also match lines with "CPUnn:". Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> [es: simplified regexp; tweaked commit message] Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
John Paul Adrian Glaubitz committed
May 20, 2024 at 15:01 UTC
45db5ed3b2f9f1c4768633f3d691bbe1305cf9ca
1 file changed
+1
-1
t/chainlint.pl
+1
-1
@@ -715,7 +715,7 @@ sub ncores {
715
if (open my $fh, '<', '/proc/cpuinfo') {
716
my $cpuinfo = do { local $/; <$fh> };
717
close($fh);
718
- my @matches = ($cpuinfo =~ /^processor[\s\d]*:/mg);
718
+ my @matches = ($cpuinfo =~ /^(processor|CPU)[\s\d]*:/mg);
719
return @matches ? scalar(@matches) : 1;
720
}
721
# macOS & BSD