From: Jeff King <hidden> Date: 2021-08-11 14:03:31
On Wed, Aug 11, 2021 at 03:02:52PM +0200, Son Luong Ngoc wrote:
git/t% GIT_TEST_FAIL_PREREQS=1 ./t5607-clone-bundle.sh
[...]
# if ! test_have_prereq SHA1
# then
# echo "@object-format=sha256"
# fi >expect &&
The problem is presumably here. If test_have_prereq lies and say "no, we
are using sha256" then we cannot expect what the built binary does to
match that lie.
Perhaps that is a sign that test_have_prereq is not the right tool to
check "which hash format are we using", but I don't think we have
another convenient mechanism to do so currently.
I also think that the FAIL_PREREQS system may be mis-designed a bit. We
had a similar problem a few months ago, and I think Junio's response
here points in a good direction:
https://lore.kernel.org/git/xmqqblbgrwkg.fsf@gitster.g/
-Peff
From: brian m. carlson <hidden> Date: 2021-08-11 23:15:28
On 2021-08-11 at 14:03:25, Jeff King wrote:
On Wed, Aug 11, 2021 at 03:02:52PM +0200, Son Luong Ngoc wrote:
quoted
git/t% GIT_TEST_FAIL_PREREQS=1 ./t5607-clone-bundle.sh
[...]
# if ! test_have_prereq SHA1
# then
# echo "@object-format=sha256"
# fi >expect &&
The problem is presumably here. If test_have_prereq lies and say "no, we
are using sha256" then we cannot expect what the built binary does to
match that lie.
Perhaps that is a sign that test_have_prereq is not the right tool to
check "which hash format are we using", but I don't think we have
another convenient mechanism to do so currently.
We can use something like this:
if "$(test_oid algo)" != sha1
I also think that the FAIL_PREREQS system may be mis-designed a bit. We
had a similar problem a few months ago, and I think Junio's response
here points in a good direction:
https://lore.kernel.org/git/xmqqblbgrwkg.fsf@gitster.g/
I take no position on this, but I'll send a patch to do something
similar to the above in a few minutes in case someone feels like picking
it up.
--
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
From: brian m. carlson <hidden> Date: 2021-08-11 23:17:02
In this test, we currently use the SHA1 prerequisite to specify the
algorithm we're using to test, since SHA-256 bundles are always v3,
whereas SHA-1 bundles default to v2, and as a result the default output
differs.
However, this causes a problem if we run with GIT_TEST_FAIL_PREREQS set,
since that means that we'll unexpectedly fail the SHA1 prerequisite,
resulting in incorrect expected output. Let's fix this by checking
against the built-in data called "algo", which tells us which algorithm
is in use. This should work in any situation, making our test a little
more robust.
Signed-off-by: brian m. carlson <redacted>
---
t/t5607-clone-bundle.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
From: Jeff King <hidden> Date: 2021-08-11 23:30:25
On Wed, Aug 11, 2021 at 11:16:44PM +0000, brian m. carlson wrote:
In this test, we currently use the SHA1 prerequisite to specify the
algorithm we're using to test, since SHA-256 bundles are always v3,
whereas SHA-1 bundles default to v2, and as a result the default output
differs.
However, this causes a problem if we run with GIT_TEST_FAIL_PREREQS set,
since that means that we'll unexpectedly fail the SHA1 prerequisite,
resulting in incorrect expected output. Let's fix this by checking
against the built-in data called "algo", which tells us which algorithm
is in use. This should work in any situation, making our test a little
more robust.
Thanks, this seems like a reasonable step, and fixes the test for me.
I still get tons of other failures because I set GIT_TEST_HTTPD=yes,
which implies to me we should still be fixing GIT_TEST_FAIL_PREREQS. But
I am happy to take this in the meantime for people who do care.
-Peff