]> git.ipfire.org Git - thirdparty/git.git/commitdiff
chainlint.pl: fix incorrect CPU count on Linux SPARC
authorJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Mon, 20 May 2024 19:01:30 +0000 (15:01 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 May 2024 18:58:40 +0000 (11:58 -0700)
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>
t/chainlint.pl

index 28e2506032af8f2b0247f4f5e35ade6e041c643c..ea154a206ac2a81c319b12db97d75ae65850b591 100755 (executable)
@@ -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