indexer: Initialise all members of git_indexer_progress #7049
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have a push_transfer_progress callback registered when calling git_remote_push, where I forward on the "bytes" argument to some progress reporting. For local pushes, the received_bytes member is uninitialized. If you take the change I made to the attached test and run it through valgrind:
valgrind ./libgit2_tests -snetwork::remote::local::push_to_bare_remote
you'll see:
`
==2411490== Memcheck, a memory error detector
==2411490== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==2411490== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==2411490== Command: ./libgit2_tests -snetwork::remote::local::push_to_bare_remote
==2411490==
Loaded 385 suites:
Started (test status codes: OK='.' FAILURE='F' SKIPPED='S')
==2411490== Conditional jump or move depends on uninitialised value(s)
==2411490== at 0x14F360: clar__assert (clar.c:756)
==2411490== by 0x26166E: push_transfer_progress_cb (local.c:21)
==2411490== by 0x4467C7: transfer_to_push_transfer (local.c:371)
==2411490== by 0x3BF633: do_progress_callback (indexer.c:636)
==2411490== by 0x3BFF2D: git_indexer_append (indexer.c:932)
==2411490== by 0x3ED607: write_cb (pack-objects.c:1409)
==2411490== by 0x3EB2E2: write_pack (pack-objects.c:659)
==2411490== by 0x3ED4FA: git_packbuilder_foreach (pack-objects.c:1390)
==2411490== by 0x3ED7C8: git_packbuilder_write (pack-objects.c:1461)
==2411490== by 0x44697E: local_push (local.c:419)
==2411490== by 0x3FE7F4: do_push (push.c:486)
==2411490== by 0x3FE994: git_push_finish (push.c:534)
==2411490==
F.
network::remote::local::push_to_bare_remote [/local-ssd/lmcglash/libgit2/libgit2/tests/libgit2/network/remote/local.c:21]
Expression is not true: bytes == 0
`
I suppose it's fundamentally more to do with transfer_to_push_transfer doing something clever for local pushes (what does received_bytes mean there?).