{"thread":{"id":"63752","subject":"[PATCH 0/2] t: fixes for Perl-less tests","startedAt":"2025-07-07T11:08:53Z","lastAt":"2025-07-08T06:44:42Z","messageCount":5,"participants":["Patrick Steinhardt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"521425","messageId":"20250707-b4-pks-t-perlless-fixes-v1-0-92b2de1c3dd0@pks.im","threadId":"63752","inReplyTo":null,"subject":"[PATCH 0/2] t: fixes for Perl-less tests","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-07T11:08:32Z","receivedAt":"2025-07-07T11:08:53Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Hi,\n\nthis small patch series addresses two issues introduced by my\nconversion away from Perl in some of our tests, as reported by SZEDER\n[1].\n\nThanks!\n\nPatrick\n\n[1]: <aEiNBwUkjbo2QlFY@szeder.dev>\n\n---\nPatrick Steinhardt (2):\n      t4150: fix warning printed by awk due to escaped '\\@'\n      t5333: fix missing terminator for sed(1) 's' command\n\n t/t4150-am.sh                   | 2 +-\n t/t5333-pseudo-merge-bitmaps.sh | 4 ++--\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\n\n---\nbase-commit: 8b6f19ccfc3aefbd0f22f6b7d56ad6a3fc5e4f37\nchange-id: 20250707-b4-pks-t-perlless-fixes-4dd2280de666\n\n"},{"id":"521426","messageId":"20250707-b4-pks-t-perlless-fixes-v1-1-92b2de1c3dd0@pks.im","threadId":"63752","inReplyTo":"20250707-b4-pks-t-perlless-fixes-v1-0-92b2de1c3dd0@pks.im","subject":"[PATCH 1/2] t4150: fix warning printed by awk due to escaped '\\@'","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-07T11:08:33Z","receivedAt":"2025-07-07T11:08:55Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 6aec8d38fdd (t: refactor tests depending on Perl to print data,\n2025-04-03) we have changed one of the tests in t4150 to use awk(1)\ninstead of Perl. The test works, but at least gawk(1) prints a warning\nnow:\n\n    awk: cmd. line:3: warning: escape sequence `\\@' treated as plain `@'\n\nFix this by removing the backslash.\n\nReported-by: SZEDER Gábor <szeder.dev@gmail.com>\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n t/t4150-am.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 2ae93d3c967..699a81ab5cc 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -1086,7 +1086,7 @@ test_expect_success 'am works with multi-line in-body headers' '\n \t# bump from, date, and subject down to in-body header\n \tawk \"\n \t\t/^From:/{\n-\t\t\tprint \\\"From: x <x\\@example.com>\\\";\n+\t\t\tprint \\\"From: x <x@example.com>\\\";\n \t\t\tprint \\\"Date: Sat, 1 Jan 2000 00:00:00 +0000\\\";\n \t\t\tprint \\\"Subject: x\\n\\\";\n \t\t}; 1\n\n-- \n2.50.0.195.g74e6fc65d0.dirty\n\n"},{"id":"521427","messageId":"20250707-b4-pks-t-perlless-fixes-v1-2-92b2de1c3dd0@pks.im","threadId":"63752","inReplyTo":"20250707-b4-pks-t-perlless-fixes-v1-0-92b2de1c3dd0@pks.im","subject":"[PATCH 2/2] t5333: fix missing terminator for sed(1) 's' command","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-07T11:08:34Z","receivedAt":"2025-07-07T11:08:58Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In 6aec8d38fdd (t: refactor tests depending on Perl to print data,\n2025-04-03) we have changed some of the tests in t4150 to use sed(1)\ninstead of Perl. One of the conversions is broken though:\n\n    sed: -e expression #1, char 41: unterminated `s' command\n\nCuriously enough, the test itself still passes. This is caused by a\nsequence of failures:\n\n  1. The output of sed(1) is piped into git-update-ref(1), and because\n     sed(1) is the upstream command we don't notice that it fails.\n\n  2. git-update-ref(1) does not receive any input and thus won't create\n     any references.\n\n  3. We then repack the repository with the configured pseudo merges\n     pattern, but as we didn't create any references the pattern doesn't\n     match anything.\n\n  4. We use `test_pseudo_merges()` to compute the list of pseudo-merges\n     and write it into a file. This file is empty as there are none.\n\n  5. The loop over the pseudo-merges becomes a no-op.\n\n  6. The final test succeeds as well because the number of lines in an\n     empty file is obviously the same as the number of unique lines,\n     namely zero.\n\nFix the issue by adding the terminating '|' to the sed(1) command.\nFurthermore, make the test a tiny bit more robust by not using it as\npart of a pipe.\n\nReported-by: SZEDER Gábor <szeder.dev@gmail.com>\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n t/t5333-pseudo-merge-bitmaps.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh\nindex ba5ae6a00c9..1f7a5d82ee4 100755\n--- a/t/t5333-pseudo-merge-bitmaps.sh\n+++ b/t/t5333-pseudo-merge-bitmaps.sh\n@@ -234,8 +234,8 @@ test_expect_success 'pseudo-merge pattern with capture groups' '\n \t\t\ttest_commit_bulk 16 &&\n \n \t\t\tgit rev-list HEAD~16.. >in &&\n-\t\t\tsed \"s|\\(.*\\)|create refs/remotes/$r/tags/\\1 \\1\" in |\n-\t\t\tgit update-ref --stdin || return 1\n+\t\t\tsed \"s|\\(.*\\)|create refs/remotes/$r/tags/\\1 \\1|\" in >refs &&\n+\t\t\tgit update-ref --stdin <refs || return 1\n \t\tdone &&\n \n \t\tgit \\\n\n-- \n2.50.0.195.g74e6fc65d0.dirty\n\n"},{"id":"521448","messageId":"xmqqplec3rka.fsf@gitster.g","threadId":"63752","inReplyTo":"20250707-b4-pks-t-perlless-fixes-v1-2-92b2de1c3dd0@pks.im","subject":"Re: [PATCH 2/2] t5333: fix missing terminator for sed(1) 's' command","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-07T16:15:49Z","receivedAt":"2025-07-07T16:15:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> In 6aec8d38fdd (t: refactor tests depending on Perl to print data,\n> 2025-04-03) we have changed some of the tests in t4150 to use sed(1)\n> instead of Perl. One of the conversions is broken though:\n>\n>     sed: -e expression #1, char 41: unterminated `s' command\n>\n> Curiously enough, the test itself still passes. This is caused by a\n> sequence of failures:\n>\n>   1. The output of sed(1) is piped into git-update-ref(1), and because\n>      sed(1) is the upstream command we don't notice that it fails.\n>\n>   2. git-update-ref(1) does not receive any input and thus won't create\n>      any references.\n>\n>   3. We then repack the repository with the configured pseudo merges\n>      pattern, but as we didn't create any references the pattern doesn't\n>      match anything.\n>\n>   4. We use `test_pseudo_merges()` to compute the list of pseudo-merges\n>      and write it into a file. This file is empty as there are none.\n>\n>   5. The loop over the pseudo-merges becomes a no-op.\n>\n>   6. The final test succeeds as well because the number of lines in an\n>      empty file is obviously the same as the number of unique lines,\n>      namely zero.\n>\n> Fix the issue by adding the terminating '|' to the sed(1) command.\n\nOK.\n\n> Furthermore, make the test a tiny bit more robust by not using it as\n> part of a pipe.\n\nWhile I do not think it would give us big enough improvement to\nrevert this part of the change, I would have liked not to see this\n\"furthermore\" change.  We are not in the business of catching\nsegfault in 'sed' that is supplied by the platform, so there is no\npoint in breaking the pipeline here.\n\nWill queue.  Thanks.\n\n> Reported-by: SZEDER Gábor <szeder.dev@gmail.com>\n> Signed-off-by: Patrick Steinhardt <ps@pks.im>\n> ---\n>  t/t5333-pseudo-merge-bitmaps.sh | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh\n> index ba5ae6a00c9..1f7a5d82ee4 100755\n> --- a/t/t5333-pseudo-merge-bitmaps.sh\n> +++ b/t/t5333-pseudo-merge-bitmaps.sh\n> @@ -234,8 +234,8 @@ test_expect_success 'pseudo-merge pattern with capture groups' '\n>  \t\t\ttest_commit_bulk 16 &&\n>  \n>  \t\t\tgit rev-list HEAD~16.. >in &&\n> -\t\t\tsed \"s|\\(.*\\)|create refs/remotes/$r/tags/\\1 \\1\" in |\n> -\t\t\tgit update-ref --stdin || return 1\n> +\t\t\tsed \"s|\\(.*\\)|create refs/remotes/$r/tags/\\1 \\1|\" in >refs &&\n> +\t\t\tgit update-ref --stdin <refs || return 1\n>  \t\tdone &&\n>  \n>  \t\tgit \\\n"},{"id":"521505","messageId":"aGy-VBk5nO8UJItZ@pks.im","threadId":"63752","inReplyTo":"xmqqplec3rka.fsf@gitster.g","subject":"Re: [PATCH 2/2] t5333: fix missing terminator for sed(1) 's' command","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-08T06:44:36Z","receivedAt":"2025-07-08T06:44:42Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Mon, Jul 07, 2025 at 09:15:49AM -0700, Junio C Hamano wrote:\n> Patrick Steinhardt <ps@pks.im> writes:\n> \n> > In 6aec8d38fdd (t: refactor tests depending on Perl to print data,\n> > 2025-04-03) we have changed some of the tests in t4150 to use sed(1)\n> > instead of Perl. One of the conversions is broken though:\n> >\n> >     sed: -e expression #1, char 41: unterminated `s' command\n> >\n> > Curiously enough, the test itself still passes. This is caused by a\n> > sequence of failures:\n> >\n> >   1. The output of sed(1) is piped into git-update-ref(1), and because\n> >      sed(1) is the upstream command we don't notice that it fails.\n> >\n> >   2. git-update-ref(1) does not receive any input and thus won't create\n> >      any references.\n> >\n> >   3. We then repack the repository with the configured pseudo merges\n> >      pattern, but as we didn't create any references the pattern doesn't\n> >      match anything.\n> >\n> >   4. We use `test_pseudo_merges()` to compute the list of pseudo-merges\n> >      and write it into a file. This file is empty as there are none.\n> >\n> >   5. The loop over the pseudo-merges becomes a no-op.\n> >\n> >   6. The final test succeeds as well because the number of lines in an\n> >      empty file is obviously the same as the number of unique lines,\n> >      namely zero.\n> >\n> > Fix the issue by adding the terminating '|' to the sed(1) command.\n> \n> OK.\n> \n> > Furthermore, make the test a tiny bit more robust by not using it as\n> > part of a pipe.\n> \n> While I do not think it would give us big enough improvement to\n> revert this part of the change, I would have liked not to see this\n> \"furthermore\" change.  We are not in the business of catching\n> segfault in 'sed' that is supplied by the platform, so there is no\n> point in breaking the pipeline here.\n> \n> Will queue.  Thanks.\n\nSegfaults not, but if the pipeline was broken up from the beginning we\nwould have noticed that sed(1) returned an error due to the missing\nseparator. True though that it doesn't buy us much now that the error is\nfixed. It's not like this line of code is likely to change regularly in\nthe future.\n\nI'll not send a new version of this patch series to get rid of it, but\nif I need to resend I'll remove that part.\n\nThanks!\n\nPatrick\n"}]}