diff mbox series

[2/3] chainlint.pl: fix incorrect CPU count on Linux SPARC

Message ID 20240520190131.94904-3-ericsunshine@charter.net (mailing list archive)
State Accepted
Commit 45db5ed3b2f9f1c4768633f3d691bbe1305cf9ca
Headers show
Series chainlint.pl: Extend regexp pattern for /proc/cpuinfo on Linux SPARC | expand

Commit Message

Eric Sunshine May 20, 2024, 7:01 p.m. UTC
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

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>
---
 t/chainlint.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Carlo Marcelo Arenas Belón May 22, 2024, 8:32 a.m. UTC | #1
On Mon, May 20, 2024 at 03:01:30PM UTC, Eric Sunshine wrote:
> From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> 
> On SPARC systems running Linux, individual processors are denoted with
> "CPUnn:" in /proc/cpuinfo instead of the usual "processor NN:".

not sure if worth a reroll, but the "usual" syntax is "processor  : NN"
the regexp used checks for numbers before the colon to account for the
syntax used on s390x which is the only one with numbers before the colon.

Carlo
John Paul Adrian Glaubitz May 22, 2024, 8:47 a.m. UTC | #2
Hi Carlo,

On Wed, 2024-05-22 at 01:32 -0700, Carlo Marcelo Arenas Belón wrote:
> On Mon, May 20, 2024 at 03:01:30PM UTC, Eric Sunshine wrote:
> > From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> > 
> > On SPARC systems running Linux, individual processors are denoted with
> > "CPUnn:" in /proc/cpuinfo instead of the usual "processor NN:".
> 
> not sure if worth a reroll, but the "usual" syntax is "processor  : NN"
> the regexp used checks for numbers before the colon to account for the
> syntax used on s390x which is the only one with numbers before the colon.

Good catch. I think this can just be fixed by whoever commits the patches
or is that done automatically?

Adrian
Eric Sunshine May 22, 2024, 9:05 a.m. UTC | #3
On Wed, May 22, 2024 at 4:47 AM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On Wed, 2024-05-22 at 01:32 -0700, Carlo Marcelo Arenas Belón wrote:
> > On Mon, May 20, 2024 at 03:01:30PM UTC, Eric Sunshine wrote:
> > > From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> > >
> > > On SPARC systems running Linux, individual processors are denoted with
> > > "CPUnn:" in /proc/cpuinfo instead of the usual "processor NN:".
> >
> > not sure if worth a reroll, but the "usual" syntax is "processor  : NN"
> > the regexp used checks for numbers before the colon to account for the
> > syntax used on s390x which is the only one with numbers before the colon.
>
> Good catch. I think this can just be fixed by whoever commits the patches
> or is that done automatically?

Inclusion of the word "usual" is such a minor flaw in the commit
message that I doubt it warrants a reroll and the associated cost on
reviewers and on the maintainer (Junio), especially since it does not
negatively impact the intent conveyed by the commit messages nor the
correctness of the actual patch.

As such, I'm not worried about it. Whether Junio reads this and wants
to correct it in his tree is up to him, of course.
Junio C Hamano May 22, 2024, 7 p.m. UTC | #4
Eric Sunshine <sunshine@sunshineco.com> writes:

>> > > "CPUnn:" in /proc/cpuinfo instead of the usual "processor NN:".
>> >
>> > not sure if worth a reroll, but the "usual" syntax is "processor  : NN"
> ...
> Inclusion of the word "usual" is such a minor flaw in the commit
> message that I doubt it warrants a reroll and the associated cost on
> reviewers and on the maintainer (Junio), especially since it does not
> negatively impact the intent conveyed by the commit messages nor the
> correctness of the actual patch.
>
> As such, I'm not worried about it. Whether Junio reads this and wants
> to correct it in his tree is up to him, of course.

I think "usual" is not what was pointed out. The order between the
colon and NN is.
Eric Sunshine May 22, 2024, 7:11 p.m. UTC | #5
On Wed, May 22, 2024 at 3:00 PM Junio C Hamano <gitster@pobox.com> wrote:
> Eric Sunshine <sunshine@sunshineco.com> writes:
> >> > > "CPUnn:" in /proc/cpuinfo instead of the usual "processor NN:".
> >> >
> >> > not sure if worth a reroll, but the "usual" syntax is "processor  : NN"
> > ...
> > Inclusion of the word "usual" is such a minor flaw in the commit
> > message that I doubt it warrants a reroll and the associated cost on
> > reviewers and on the maintainer (Junio), especially since it does not
> > negatively impact the intent conveyed by the commit messages nor the
> > correctness of the actual patch.
> >
> > As such, I'm not worried about it. Whether Junio reads this and wants
> > to correct it in his tree is up to him, of course.
>
> I think "usual" is not what was pointed out. The order between the
> colon and NN is.

Yes, I understood that, but it is the word "usual" which makes the
text "processor NN:" questionable since "processor NN:" is not
typical. Without the word "usual", stating "processor NN:" is not
especially problematic since the existing regex (which is being
changed by this patch) _does_ match "processor NN:" (among others such
as "processor:").

If we want to be more accurate, better wording might be:

    On SPARC systems running Linux, individual processors are denoted
    with "CPUnn:" in /proc/cpuinfo, however, the regexp in ncores()
    matches only "processor:" or "processor NN:". As a result, no
    processors are found on SPARC. Address this shortcoming by
    extending the regexp to also match lines with "CPUnn:".

but I doubt it is worth a reroll.
John Paul Adrian Glaubitz May 27, 2024, 7:48 p.m. UTC | #6
Hi,

On Wed, 2024-05-22 at 15:11 -0400, Eric Sunshine wrote:
> On Wed, May 22, 2024 at 3:00 PM Junio C Hamano <gitster@pobox.com> wrote:
> > Eric Sunshine <sunshine@sunshineco.com> writes:
> > > > > > "CPUnn:" in /proc/cpuinfo instead of the usual "processor NN:".
> > > > > 
> > > > > not sure if worth a reroll, but the "usual" syntax is "processor  : NN"
> > > ...
> > > Inclusion of the word "usual" is such a minor flaw in the commit
> > > message that I doubt it warrants a reroll and the associated cost on
> > > reviewers and on the maintainer (Junio), especially since it does not
> > > negatively impact the intent conveyed by the commit messages nor the
> > > correctness of the actual patch.
> > > 
> > > As such, I'm not worried about it. Whether Junio reads this and wants
> > > to correct it in his tree is up to him, of course.
> > 
> > I think "usual" is not what was pointed out. The order between the
> > colon and NN is.
> 
> Yes, I understood that, but it is the word "usual" which makes the
> text "processor NN:" questionable since "processor NN:" is not
> typical. Without the word "usual", stating "processor NN:" is not
> especially problematic since the existing regex (which is being
> changed by this patch) _does_ match "processor NN:" (among others such
> as "processor:").
> 
> If we want to be more accurate, better wording might be:
> 
>     On SPARC systems running Linux, individual processors are denoted
>     with "CPUnn:" in /proc/cpuinfo, however, the regexp in ncores()
>     matches only "processor:" or "processor NN:". As a result, no
>     processors are found on SPARC. Address this shortcoming by
>     extending the regexp to also match lines with "CPUnn:".
> 
> but I doubt it is worth a reroll.

So, could we get this series merged now or is there anything missing?

Thanks,
Adrian
Eric Sunshine May 27, 2024, 8:12 p.m. UTC | #7
On Mon, May 27, 2024 at 3:49 PM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> So, could we get this series merged now or is there anything missing?

This series has already migrated from the "seen" branch to the "next"
branch in Junio's tree, and according to his latest "What's Cooking"
report[*], he will be merging it to his "master" branch soon, after
which it should be incorporated into an actual release.

[*]: topic "es/chainlint-ncores-fix " in
https://lore.kernel.org/git/xmqq8qzyifnx.fsf@gitster.g/
diff mbox series

Patch

diff --git a/t/chainlint.pl b/t/chainlint.pl
index d9a2691889..d593cb95e7 100755
--- a/t/chainlint.pl
+++ b/t/chainlint.pl
@@ -724,7 +724,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