mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Andreas Hasenack via GitGitGadget" <>
Cc: Andreas Hasenack <>,
	Andreas Hasenack <>
Subject: [PATCH] fix /proc/cpuinfo regexp
Date: Tue, 22 Nov 2022 20:27:41 +0000	[thread overview]
Message-ID: <> (raw)

From: Andreas Hasenack <>

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 script exits without doing anything.

Signed-off-by: Andreas Hasenack <>
--- fix /proc/cpuinfo regexp

Fetch-It-Via: git fetch pr-git-1385/panlinux/upstream-fix-cpuinfo-regexp-v1

 t/ | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/ b/t/
index 976db4b8a01..31cc086f964 100755
--- a/t/
+++ b/t/
@@ -656,7 +656,7 @@ sub ncores {
 	# Windows
 	# 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

             reply	other threads:[~2022-11-22 20:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 20:27 Andreas Hasenack via GitGitGadget [this message]
2022-11-22 20:57 ` [PATCH] fix /proc/cpuinfo regexp Eric Sunshine
2022-11-23  1:21   ` Junio C Hamano
2022-11-23 12:16     ` Andreas Hasenack
2022-11-23 15:52       ` Eric Sunshine
2022-11-23 23:53       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).