{"thread":{"id":"58840","subject":"[PATCH] chainlint.pl: fix /proc/cpuinfo regexp","startedAt":"2022-11-22T20:27:49Z","lastAt":"2022-11-23T23:54:02Z","messageCount":6,"participants":["Andreas Hasenack via GitGitGadget","Eric Sunshine","Junio C Hamano","Andreas Hasenack"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"467811","messageId":"pull.1385.git.git.1669148861635.gitgitgadget@gmail.com","threadId":"58840","inReplyTo":null,"subject":"[PATCH] chainlint.pl: fix /proc/cpuinfo regexp","fromName":"Andreas Hasenack via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-11-22T20:27:41Z","receivedAt":"2022-11-22T20:27:49Z","isPatch":true,"sender":{"key":"andreas@canonical.com","avatar":"https://gravatar.com/avatar/184265ba468b2b41263e8e984908a651fc48b2b1fb3842090b93ca91a69630de?d=mp&s=160"},"body":"From: Andreas Hasenack <andreas.hasenack@canonical.com>\n\ngit commit 29fb2ec384a867ca577335a12f4b45c184e7b642 introduced a\nfunction that gets the number of cores from /proc/cpuinfo on some\nsystems, notably linux.\n\nThe regexp it uses (^processor\\s*:) fails to match the desired lines in\nthe s390x architecture, where they look like this:\n\nprocessor 0: version = FF, identification = 148F67, machine = 2964\n\nAs a result, on s390x that function returns 0 as the number of cores,\nand the chainlint.pl script exits without doing anything.\n\nSigned-off-by: Andreas Hasenack <andreas.hasenack@canonical.com>\n---\n    chainlint.pl: fix /proc/cpuinfo regexp\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1385%2Fpanlinux%2Fupstream-fix-cpuinfo-regexp-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1385/panlinux/upstream-fix-cpuinfo-regexp-v1\nPull-Request: https://github.com/git/git/pull/1385\n\n t/chainlint.pl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/chainlint.pl b/t/chainlint.pl\nindex 976db4b8a01..31cc086f964 100755\n--- a/t/chainlint.pl\n+++ b/t/chainlint.pl\n@@ -656,7 +656,7 @@ sub ncores {\n \t# Windows\n \treturn $ENV{NUMBER_OF_PROCESSORS} if exists($ENV{NUMBER_OF_PROCESSORS});\n \t# Linux / MSYS2 / Cygwin / WSL\n-\tdo { local @ARGV='/proc/cpuinfo'; return scalar(grep(/^processor\\s*:/, <>)); } if -r '/proc/cpuinfo';\n+\tdo { local @ARGV='/proc/cpuinfo'; return scalar(grep(/^processor[\\s\\d]*:/, <>)); } if -r '/proc/cpuinfo';\n \t# macOS & BSD\n \treturn qx/sysctl -n hw.ncpu/ if $^O =~ /(?:^darwin$|bsd)/;\n \treturn 1;\n\nbase-commit: a0789512c5a4ae7da935cd2e419f253cb3cb4ce7\n-- \ngitgitgadget\n"},{"id":"467813","messageId":"CAPig+cQ6_7wf6C280Rqi7mcTCiQp-n5GiLWTPazfcUcGFeZi0g@mail.gmail.com","threadId":"58840","inReplyTo":"pull.1385.git.git.1669148861635.gitgitgadget@gmail.com","subject":"Re: [PATCH] chainlint.pl: fix /proc/cpuinfo regexp","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2022-11-22T20:57:55Z","receivedAt":"2022-11-22T20:58:25Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Nov 22, 2022 at 3:29 PM Andreas Hasenack via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n> git commit 29fb2ec384a867ca577335a12f4b45c184e7b642 introduced a\n> function that gets the number of cores from /proc/cpuinfo on some\n> systems, notably linux.\n\nThanks for diagnosing this problem and quickly submitting a patch.\n\nI forgot to mention earlier that we typically cite other commits like this:\n\n    29fb2ec384 (chainlint.pl: validate test scripts in parallel, 2022-09-01)\n\nwhich you can generate automatically with:\n\n    git log --pretty=reference -1 29fb2ec384\n\n> The regexp it uses (^processor\\s*:) fails to match the desired lines in\n> the s390x architecture, where they look like this:\n>\n> processor 0: version = FF, identification = 148F67, machine = 2964\n>\n> As a result, on s390x that function returns 0 as the number of cores,\n> and the chainlint.pl script exits without doing anything.\n\nMakes sense. Well explained.\n\nA separate problem is that chainlint.pl doesn't fall back to a\nsensible non-zero value if ncores() returns 0 (or some other nonsense\nvalue). That is, of course, outside the scope of the well-focused\nproblem fix which this standalone patch addresses. I may end up\nsubmitting a fix separately to make it fall back sensibly.\n\n> Signed-off-by: Andreas Hasenack <andreas.hasenack@canonical.com>\n> ---\n> diff --git a/t/chainlint.pl b/t/chainlint.pl\n> @@ -656,7 +656,7 @@ sub ncores {\n>         # Windows\n>         return $ENV{NUMBER_OF_PROCESSORS} if exists($ENV{NUMBER_OF_PROCESSORS});\n>         # Linux / MSYS2 / Cygwin / WSL\n> -       do { local @ARGV='/proc/cpuinfo'; return scalar(grep(/^processor\\s*:/, <>)); } if -r '/proc/cpuinfo';\n> +       do { local @ARGV='/proc/cpuinfo'; return scalar(grep(/^processor[\\s\\d]*:/, <>)); } if -r '/proc/cpuinfo';\n>         # macOS & BSD\n>         return qx/sysctl -n hw.ncpu/ if $^O =~ /(?:^darwin$|bsd)/;\n>         return 1;\n\nAs mentioned elsewhere[1], this code may eventually be dropped\naltogether, but this fix is good to have in the meantime. Thanks.\n\n[1]: https://lore.kernel.org/git/CAPig+cQrXb-YUSzmfgJ2PRoiOP3goVACRCrX9C39kf3oDH+BHg@mail.gmail.com/\n"},{"id":"467841","messageId":"xmqqsfiao47q.fsf@gitster.g","threadId":"58840","inReplyTo":"CAPig+cQ6_7wf6C280Rqi7mcTCiQp-n5GiLWTPazfcUcGFeZi0g@mail.gmail.com","subject":"Re: [PATCH] chainlint.pl: fix /proc/cpuinfo regexp","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-11-23T01:21:45Z","receivedAt":"2022-11-23T01:22:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> Makes sense. Well explained.\n>\n> A separate problem is that chainlint.pl doesn't fall back to a\n> sensible non-zero value if ncores() returns 0 (or some other nonsense\n> value). That is, of course, outside the scope of the well-focused\n> problem fix which this standalone patch addresses. I may end up\n> submitting a fix separately to make it fall back sensibly.\n> ...\n> As mentioned elsewhere[1], this code may eventually be dropped\n> altogether, but this fix is good to have in the meantime. Thanks.\n\nThanks, both.  Will apply.\n"},{"id":"467863","messageId":"CANYNYEETCaaQGOXVLrRCC8wdS-uD66BHqr98Eetb+1GVk5WkTg@mail.gmail.com","threadId":"58840","inReplyTo":"xmqqsfiao47q.fsf@gitster.g","subject":"Re: [PATCH] chainlint.pl: fix /proc/cpuinfo regexp","fromName":"Andreas Hasenack","fromEmail":"andreas@canonical.com","sentAt":"2022-11-23T12:16:51Z","receivedAt":"2022-11-23T12:17:12Z","isPatch":true,"sender":{"key":"andreas@canonical.com","avatar":"https://gravatar.com/avatar/184265ba468b2b41263e8e984908a651fc48b2b1fb3842090b93ca91a69630de?d=mp&s=160"},"body":"Should I still change the commit message regarding where I mention the\ncommit that introduced this, as explained by Eric? From the activity I\nsaw overnight it looks like things were already picked up and it\ndoesn't matter anymore.\n\nOn Tue, Nov 22, 2022 at 10:21 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Eric Sunshine <sunshine@sunshineco.com> writes:\n>\n> > Makes sense. Well explained.\n> >\n> > A separate problem is that chainlint.pl doesn't fall back to a\n> > sensible non-zero value if ncores() returns 0 (or some other nonsense\n> > value). That is, of course, outside the scope of the well-focused\n> > problem fix which this standalone patch addresses. I may end up\n> > submitting a fix separately to make it fall back sensibly.\n> > ...\n> > As mentioned elsewhere[1], this code may eventually be dropped\n> > altogether, but this fix is good to have in the meantime. Thanks.\n>\n> Thanks, both.  Will apply.\n"},{"id":"467872","messageId":"CAPig+cSVjnrHEZxosbS1Au7LRbDRZt_r9dr78S37FPXdb3W2QA@mail.gmail.com","threadId":"58840","inReplyTo":"CANYNYEETCaaQGOXVLrRCC8wdS-uD66BHqr98Eetb+1GVk5WkTg@mail.gmail.com","subject":"Re: [PATCH] chainlint.pl: fix /proc/cpuinfo regexp","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2022-11-23T15:52:48Z","receivedAt":"2022-11-23T15:53:54Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Nov 23, 2022 at 7:17 AM Andreas Hasenack <andreas@canonical.com> wrote:\n> Should I still change the commit message regarding where I mention the\n> commit that introduced this, as explained by Eric? From the activity I\n> saw overnight it looks like things were already picked up and it\n> doesn't matter anymore.\n\nNo need to resend. Junio tweaked the commit message[1] when he picked\nup the patch.\n\n[1]: https://github.com/git/git/commit/1f51b77f4f3f4d05f249f80713b2969e4069c109\n"},{"id":"467888","messageId":"xmqqfse9mdm2.fsf@gitster.g","threadId":"58840","inReplyTo":"CANYNYEETCaaQGOXVLrRCC8wdS-uD66BHqr98Eetb+1GVk5WkTg@mail.gmail.com","subject":"Re: [PATCH] chainlint.pl: fix /proc/cpuinfo regexp","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-11-23T23:53:57Z","receivedAt":"2022-11-23T23:54:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Hasenack <andreas@canonical.com> writes:\n\n> Should I still change the commit message regarding where I mention the\n> commit that introduced this, as explained by Eric? From the activity I\n> saw overnight it looks like things were already picked up and it\n> doesn't matter anymore.\n\nSorry, I should have said \"will apply with tweaked log message\" to\nreduce the need for a round-trip.  Please double check what is\nqueued in 'seen' and send in replacements before it gets merged down\nto 'next' if there are still things you may want to update.  If you\nare happy with what is in 'seen', no further action is needed at\nleast for now.\n\nThanks.\n"}]}