From: John Paul Adrian Glaubitz Date: Mon, 20 May 2024 19:01:30 +0000 (-0400) Subject: chainlint.pl: fix incorrect CPU count on Linux SPARC X-Git-Tag: v2.46.0-rc0~86^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45db5ed3b2f9f1c4768633f3d691bbe1305cf9ca;p=thirdparty%2Fgit.git 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 [es: simplified regexp; tweaked commit message] Signed-off-by: Eric Sunshine Tested-by: John Paul Adrian Glaubitz Signed-off-by: Junio C Hamano --- diff --git a/t/chainlint.pl b/t/chainlint.pl index 28e2506032..ea154a206a 100755 --- a/t/chainlint.pl +++ b/t/chainlint.pl @@ -715,7 +715,7 @@ sub ncores { if (open my $fh, '<', '/proc/cpuinfo') { my $cpuinfo = do { local $/; <$fh> }; close($fh); - my @matches = ($cpuinfo =~ /^processor[\s\d]*:/mg); + my @matches = ($cpuinfo =~ /^(processor|CPU)[\s\d]*:/mg); return @matches ? scalar(@matches) : 1; } # macOS & BSD