git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] chainlint.pl: fix /proc/cpuinfo regexp

From
Andreas Hasenack via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 22, 2022, 20:27 UTC
Message-ID
<pull.1385.git.git.1669148861635.gitgitgadget@gmail.com>
From: Andreas Hasenack <andreas.hasenack@canonical.com>

git commit 29fb2ec384a867ca577335a12f4b45c184e7b642 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>
---
    chainlint.pl: fix /proc/cpuinfo regexp
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1385%2Fpanlinux%2Fupstream-fix-cpuinfo-regexp-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1385/panlinux/upstream-fix-cpuinfo-regexp-v1
Pull-Request: https://github.com/git/git/pull/1385
 t/chainlint.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/chainlint.pl b/t/chainlint.pl
index 976db4b8a01..31cc086f964 100755
--- a/t/chainlint.pl
+++ b/t/chainlint.pl
@@ -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;

base-commit: a0789512c5a4ae7da935cd2e419f253cb3cb4ce7
-- 
gitgitgadget
Next: Eric Sunshine
Message 1 of 6 in “chainlint.pl: fix /proc/cpuinfo regexp”
  1. chainlint.pl: fix /proc/cpuinfo regexpAndreas Hasenack via GitGitGadget, Nov 22, 2022
  2. Eric SunshineNov 22, 2022
  3. Junio C HamanoNov 23, 2022
  4. Andreas HasenackNov 23, 2022
  5. Eric SunshineNov 23, 2022
  6. Junio C HamanoNov 23, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.