]> git.ipfire.org Git - thirdparty/git.git/commitdiff
chainlint.pl: fix /proc/cpuinfo regexp
authorAndreas Hasenack <andreas.hasenack@canonical.com>
Tue, 22 Nov 2022 20:27:41 +0000 (20:27 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Nov 2022 01:20:19 +0000 (10:20 +0900)
29fb2ec3 (chainlint.pl: validate test scripts in parallel,
2022-09-01) introduced a function that gets the number of cores from
/proc/cpuinfo on some systems, notably linux.

The regexp it uses (^processor\s*:) fails to match the desired lines in
the s390x architecture, where they look like this:

    processor 0: version = FF, identification = 148F67, machine = 2964

As a result, on s390x that function returns 0 as the number of cores,
and the chainlint.pl script exits without doing anything.

Signed-off-by: Andreas Hasenack <andreas.hasenack@canonical.com>
Acked-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/chainlint.pl

index 976db4b8a01b804e7e697c308f769233083a576c..31cc086f9647d30b0e123495d419599a581ec8f9 100755 (executable)
@@ -656,7 +656,7 @@ sub ncores {
        # Windows
        return $ENV{NUMBER_OF_PROCESSORS} if exists($ENV{NUMBER_OF_PROCESSORS});
        # Linux / MSYS2 / Cygwin / WSL
-       do { local @ARGV='/proc/cpuinfo'; return scalar(grep(/^processor\s*:/, <>)); } if -r '/proc/cpuinfo';
+       do { local @ARGV='/proc/cpuinfo'; return scalar(grep(/^processor[\s\d]*:/, <>)); } if -r '/proc/cpuinfo';
        # macOS & BSD
        return qx/sysctl -n hw.ncpu/ if $^O =~ /(?:^darwin$|bsd)/;
        return 1;