From: Eric Sunshine <sunshine@sunshineco.com>
To: Andreas Hasenack via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Andreas Hasenack <andreas.hasenack@canonical.com>
Subject: Re: [PATCH] chainlint.pl: fix /proc/cpuinfo regexp
Date: Tue, 22 Nov 2022 15:57:55 -0500 [thread overview]
Message-ID: <CAPig+cQ6_7wf6C280Rqi7mcTCiQp-n5GiLWTPazfcUcGFeZi0g@mail.gmail.com> (raw)
In-Reply-To: <pull.1385.git.git.1669148861635.gitgitgadget@gmail.com>
On Tue, Nov 22, 2022 at 3:29 PM Andreas Hasenack via GitGitGadget
<gitgitgadget@gmail.com> wrote:
> git commit 29fb2ec384a867ca577335a12f4b45c184e7b642 introduced a
> function that gets the number of cores from /proc/cpuinfo on some
> systems, notably linux.
Thanks for diagnosing this problem and quickly submitting a patch.
I forgot to mention earlier that we typically cite other commits like this:
29fb2ec384 (chainlint.pl: validate test scripts in parallel, 2022-09-01)
which you can generate automatically with:
git log --pretty=reference -1 29fb2ec384
> 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.
Makes sense. Well explained.
A separate problem is that chainlint.pl doesn't fall back to a
sensible non-zero value if ncores() returns 0 (or some other nonsense
value). That is, of course, outside the scope of the well-focused
problem fix which this standalone patch addresses. I may end up
submitting a fix separately to make it fall back sensibly.
> Signed-off-by: Andreas Hasenack <andreas.hasenack@canonical.com>
> ---
> diff --git 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;
As mentioned elsewhere[1], this code may eventually be dropped
altogether, but this fix is good to have in the meantime. Thanks.
[1]: https://lore.kernel.org/git/CAPig+cQrXb-YUSzmfgJ2PRoiOP3goVACRCrX9C39kf3oDH+BHg@mail.gmail.com/
next prev parent reply other threads:[~2022-11-22 20:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 20:27 [PATCH] chainlint.pl: fix /proc/cpuinfo regexp Andreas Hasenack via GitGitGadget
2022-11-22 20:57 ` Eric Sunshine [this message]
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPig+cQ6_7wf6C280Rqi7mcTCiQp-n5GiLWTPazfcUcGFeZi0g@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=andreas.hasenack@canonical.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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
https://80x24.org/mirrors/git.git
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).