Skip to content

indexer: Initialise all members of git_indexer_progress#7049

Merged
ethomson merged 1 commit into
libgit2:mainfrom
mathworks:git_indexer_stats_init
May 2, 2026
Merged

indexer: Initialise all members of git_indexer_progress#7049
ethomson merged 1 commit into
libgit2:mainfrom
mathworks:git_indexer_stats_init

Conversation

@lrm29
Copy link
Copy Markdown
Contributor

@lrm29 lrm29 commented Mar 13, 2025

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.

  1. Failure:
    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?).

@lrm29 lrm29 force-pushed the git_indexer_stats_init branch from 8c1ab9c to 56ccb9b Compare August 5, 2025 10:56
@lrm29
Copy link
Copy Markdown
Contributor Author

lrm29 commented Aug 5, 2025

Reason for test failures on Windows: 81eecc3

@lrm29 lrm29 marked this pull request as draft August 5, 2025 12:32
@ethomson
Copy link
Copy Markdown
Member

ethomson commented May 2, 2026

I'm taking the liberty to move this out of draft and into ready for review. Let me know if there were additional things that you wanted to address here!

@ethomson ethomson marked this pull request as ready for review May 2, 2026 16:34
@ethomson ethomson merged commit af30457 into libgit2:main May 2, 2026
14 of 19 checks passed
@ethomson ethomson added the v1.9.3 label May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants