10000 indexer: Initialise all members of git_indexer_progress by lrm29 · Pull Request #7049 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

indexer: Initialise all members of git_indexer_progress #7049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lrm29
Copy link
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?).

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.

1 participant
0