* [PATCH 0/2] t: fixes for Perl-less tests
@ 2025-07-07 11:08 Patrick Steinhardt
2025-07-07 11:08 ` [PATCH 1/2] t4150: fix warning printed by awk due to escaped '\@' Patrick Steinhardt
2025-07-07 11:08 ` [PATCH 2/2] t5333: fix missing terminator for sed(1) 's' command Patrick Steinhardt
0 siblings, 2 replies; 5+ messages in thread
From: Patrick Steinhardt @ 2025-07-07 11:08 UTC (permalink / raw)
To: git; +Cc: SZEDER Gábor, Junio C Hamano
Hi,
this small patch series addresses two issues introduced by my
conversion away from Perl in some of our tests, as reported by SZEDER
[1].
Thanks!
Patrick
[1]: <aEiNBwUkjbo2QlFY@szeder.dev>
---
Patrick Steinhardt (2):
t4150: fix warning printed by awk due to escaped '\@'
t5333: fix missing terminator for sed(1) 's' command
t/t4150-am.sh | 2 +-
t/t5333-pseudo-merge-bitmaps.sh | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: 8b6f19ccfc3aefbd0f22f6b7d56ad6a3fc5e4f37
change-id: 20250707-b4-pks-t-perlless-fixes-4dd2280de666
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] t4150: fix warning printed by awk due to escaped '\@'
2025-07-07 11:08 [PATCH 0/2] t: fixes for Perl-less tests Patrick Steinhardt
@ 2025-07-07 11:08 ` Patrick Steinhardt
2025-07-07 11:08 ` [PATCH 2/2] t5333: fix missing terminator for sed(1) 's' command Patrick Steinhardt
1 sibling, 0 replies; 5+ messages in thread
From: Patrick Steinhardt @ 2025-07-07 11:08 UTC (permalink / raw)
To: git; +Cc: SZEDER Gábor, Junio C Hamano
In 6aec8d38fdd (t: refactor tests depending on Perl to print data,
2025-04-03) we have changed one of the tests in t4150 to use awk(1)
instead of Perl. The test works, but at least gawk(1) prints a warning
now:
awk: cmd. line:3: warning: escape sequence `\@' treated as plain `@'
Fix this by removing the backslash.
Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/t4150-am.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 2ae93d3c967..699a81ab5cc 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -1086,7 +1086,7 @@ test_expect_success 'am works with multi-line in-body headers' '
# bump from, date, and subject down to in-body header
awk "
/^From:/{
- print \"From: x <x\@example.com>\";
+ print \"From: x <x@example.com>\";
print \"Date: Sat, 1 Jan 2000 00:00:00 +0000\";
print \"Subject: x\n\";
}; 1
--
2.50.0.195.g74e6fc65d0.dirty
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] t5333: fix missing terminator for sed(1) 's' command
2025-07-07 11:08 [PATCH 0/2] t: fixes for Perl-less tests Patrick Steinhardt
2025-07-07 11:08 ` [PATCH 1/2] t4150: fix warning printed by awk due to escaped '\@' Patrick Steinhardt
@ 2025-07-07 11:08 ` Patrick Steinhardt
2025-07-07 16:15 ` Junio C Hamano
1 sibling, 1 reply; 5+ messages in thread
From: Patrick Steinhardt @ 2025-07-07 11:08 UTC (permalink / raw)
To: git; +Cc: SZEDER Gábor, Junio C Hamano
In 6aec8d38fdd (t: refactor tests depending on Perl to print data,
2025-04-03) we have changed some of the tests in t4150 to use sed(1)
instead of Perl. One of the conversions is broken though:
sed: -e expression #1, char 41: unterminated `s' command
Curiously enough, the test itself still passes. This is caused by a
sequence of failures:
1. The output of sed(1) is piped into git-update-ref(1), and because
sed(1) is the upstream command we don't notice that it fails.
2. git-update-ref(1) does not receive any input and thus won't create
any references.
3. We then repack the repository with the configured pseudo merges
pattern, but as we didn't create any references the pattern doesn't
match anything.
4. We use `test_pseudo_merges()` to compute the list of pseudo-merges
and write it into a file. This file is empty as there are none.
5. The loop over the pseudo-merges becomes a no-op.
6. The final test succeeds as well because the number of lines in an
empty file is obviously the same as the number of unique lines,
namely zero.
Fix the issue by adding the terminating '|' to the sed(1) command.
Furthermore, make the test a tiny bit more robust by not using it as
part of a pipe.
Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/t5333-pseudo-merge-bitmaps.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh
index ba5ae6a00c9..1f7a5d82ee4 100755
--- a/t/t5333-pseudo-merge-bitmaps.sh
+++ b/t/t5333-pseudo-merge-bitmaps.sh
@@ -234,8 +234,8 @@ test_expect_success 'pseudo-merge pattern with capture groups' '
test_commit_bulk 16 &&
git rev-list HEAD~16.. >in &&
- sed "s|\(.*\)|create refs/remotes/$r/tags/\1 \1" in |
- git update-ref --stdin || return 1
+ sed "s|\(.*\)|create refs/remotes/$r/tags/\1 \1|" in >refs &&
+ git update-ref --stdin <refs || return 1
done &&
git \
--
2.50.0.195.g74e6fc65d0.dirty
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] t5333: fix missing terminator for sed(1) 's' command
2025-07-07 11:08 ` [PATCH 2/2] t5333: fix missing terminator for sed(1) 's' command Patrick Steinhardt
@ 2025-07-07 16:15 ` Junio C Hamano
2025-07-08 6:44 ` Patrick Steinhardt
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2025-07-07 16:15 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, SZEDER Gábor
Patrick Steinhardt <ps@pks.im> writes:
> In 6aec8d38fdd (t: refactor tests depending on Perl to print data,
> 2025-04-03) we have changed some of the tests in t4150 to use sed(1)
> instead of Perl. One of the conversions is broken though:
>
> sed: -e expression #1, char 41: unterminated `s' command
>
> Curiously enough, the test itself still passes. This is caused by a
> sequence of failures:
>
> 1. The output of sed(1) is piped into git-update-ref(1), and because
> sed(1) is the upstream command we don't notice that it fails.
>
> 2. git-update-ref(1) does not receive any input and thus won't create
> any references.
>
> 3. We then repack the repository with the configured pseudo merges
> pattern, but as we didn't create any references the pattern doesn't
> match anything.
>
> 4. We use `test_pseudo_merges()` to compute the list of pseudo-merges
> and write it into a file. This file is empty as there are none.
>
> 5. The loop over the pseudo-merges becomes a no-op.
>
> 6. The final test succeeds as well because the number of lines in an
> empty file is obviously the same as the number of unique lines,
> namely zero.
>
> Fix the issue by adding the terminating '|' to the sed(1) command.
OK.
> Furthermore, make the test a tiny bit more robust by not using it as
> part of a pipe.
While I do not think it would give us big enough improvement to
revert this part of the change, I would have liked not to see this
"furthermore" change. We are not in the business of catching
segfault in 'sed' that is supplied by the platform, so there is no
point in breaking the pipeline here.
Will queue. Thanks.
> Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> t/t5333-pseudo-merge-bitmaps.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh
> index ba5ae6a00c9..1f7a5d82ee4 100755
> --- a/t/t5333-pseudo-merge-bitmaps.sh
> +++ b/t/t5333-pseudo-merge-bitmaps.sh
> @@ -234,8 +234,8 @@ test_expect_success 'pseudo-merge pattern with capture groups' '
> test_commit_bulk 16 &&
>
> git rev-list HEAD~16.. >in &&
> - sed "s|\(.*\)|create refs/remotes/$r/tags/\1 \1" in |
> - git update-ref --stdin || return 1
> + sed "s|\(.*\)|create refs/remotes/$r/tags/\1 \1|" in >refs &&
> + git update-ref --stdin <refs || return 1
> done &&
>
> git \
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] t5333: fix missing terminator for sed(1) 's' command
2025-07-07 16:15 ` Junio C Hamano
@ 2025-07-08 6:44 ` Patrick Steinhardt
0 siblings, 0 replies; 5+ messages in thread
From: Patrick Steinhardt @ 2025-07-08 6:44 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, SZEDER Gábor
On Mon, Jul 07, 2025 at 09:15:49AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > In 6aec8d38fdd (t: refactor tests depending on Perl to print data,
> > 2025-04-03) we have changed some of the tests in t4150 to use sed(1)
> > instead of Perl. One of the conversions is broken though:
> >
> > sed: -e expression #1, char 41: unterminated `s' command
> >
> > Curiously enough, the test itself still passes. This is caused by a
> > sequence of failures:
> >
> > 1. The output of sed(1) is piped into git-update-ref(1), and because
> > sed(1) is the upstream command we don't notice that it fails.
> >
> > 2. git-update-ref(1) does not receive any input and thus won't create
> > any references.
> >
> > 3. We then repack the repository with the configured pseudo merges
> > pattern, but as we didn't create any references the pattern doesn't
> > match anything.
> >
> > 4. We use `test_pseudo_merges()` to compute the list of pseudo-merges
> > and write it into a file. This file is empty as there are none.
> >
> > 5. The loop over the pseudo-merges becomes a no-op.
> >
> > 6. The final test succeeds as well because the number of lines in an
> > empty file is obviously the same as the number of unique lines,
> > namely zero.
> >
> > Fix the issue by adding the terminating '|' to the sed(1) command.
>
> OK.
>
> > Furthermore, make the test a tiny bit more robust by not using it as
> > part of a pipe.
>
> While I do not think it would give us big enough improvement to
> revert this part of the change, I would have liked not to see this
> "furthermore" change. We are not in the business of catching
> segfault in 'sed' that is supplied by the platform, so there is no
> point in breaking the pipeline here.
>
> Will queue. Thanks.
Segfaults not, but if the pipeline was broken up from the beginning we
would have noticed that sed(1) returned an error due to the missing
separator. True though that it doesn't buy us much now that the error is
fixed. It's not like this line of code is likely to change regularly in
the future.
I'll not send a new version of this patch series to get rid of it, but
if I need to resend I'll remove that part.
Thanks!
Patrick
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-07-08 6:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-07 11:08 [PATCH 0/2] t: fixes for Perl-less tests Patrick Steinhardt
2025-07-07 11:08 ` [PATCH 1/2] t4150: fix warning printed by awk due to escaped '\@' Patrick Steinhardt
2025-07-07 11:08 ` [PATCH 2/2] t5333: fix missing terminator for sed(1) 's' command Patrick Steinhardt
2025-07-07 16:15 ` Junio C Hamano
2025-07-08 6:44 ` Patrick Steinhardt
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 NNTP newsgroup(s).