From: Derrick Stolee <derrickstolee@github.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, stolee@gmail.com, gitster@pobox.com,
zhiyou.jx@alibaba-inc.com, jonathantanmy@google.com,
Jeff Hostetler <git@jeffhostetler.com>
Subject: Re: [PATCH v4 04/13] pack-objects: use rev.filter when possible
Date: Thu, 10 Mar 2022 08:33:02 -0500 [thread overview]
Message-ID: <645650c1-7918-6985-a08b-cb47247b08d4@github.com> (raw)
In-Reply-To: <220310.86zglyj5xz.gmgdl@evledraar.gmail.com>
On 3/10/2022 8:11 AM, Ævar Arnfjörð Bjarmason wrote:
>
> On Wed, Mar 09 2022, Derrick Stolee via GitGitGadget wrote:
>
>> From: Derrick Stolee <derrickstolee@github.com>
>>
>> In builtin/pack-objects.c, we use a 'filter_options' global to populate
>> the --filter=<X> argument. The previous change created a pointer to a
>> filter option in 'struct rev_info', so we can use that pointer here as a
>> start to simplifying some usage of object filters.
>>
>> Signed-off-by: Derrick Stolee <derrickstolee@github.com>
>> ---
>> builtin/pack-objects.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
>> index ba2006f2212..e5b7d015d7d 100644
>> --- a/builtin/pack-objects.c
>> +++ b/builtin/pack-objects.c
>> @@ -3651,7 +3651,7 @@ static int pack_options_allow_reuse(void)
>>
>> static int get_object_list_from_bitmap(struct rev_info *revs)
>> {
>> - if (!(bitmap_git = prepare_bitmap_walk(revs, &filter_options, 0)))
>> + if (!(bitmap_git = prepare_bitmap_walk(revs, &revs->filter, 0)))
>> return -1;
>>
>> if (pack_options_allow_reuse() &&
>> @@ -3727,6 +3727,7 @@ static void get_object_list(int ac, const char **av)
>> repo_init_revisions(the_repository, &revs, NULL);
>> save_commit_buffer = 0;
>> setup_revisions(ac, av, &revs, &s_r_opt);
>> + list_objects_filter_copy(&revs.filter, &filter_options);
>>
>> /* make sure shallows are read */
>> is_repository_shallow(the_repository);
>> @@ -3777,7 +3778,7 @@ static void get_object_list(int ac, const char **av)
>>
>> if (!fn_show_object)
>> fn_show_object = show_object;
>> - traverse_commit_list_filtered(&filter_options, &revs,
>> + traverse_commit_list_filtered(&revs.filter, &revs,
>> show_commit, fn_show_object, NULL,
>> NULL);
>
> Re your
> https://lore.kernel.org/git/77c8ef4b-5dce-401b-e703-cfa32e18c853@github.com/
> I was looking at how to handle the interaction between this and my
> revisions_release() series.
>
> This adds a new memory leak, which can be seen with:
>
> make SANITIZE=leak
> (cd t && ./t5532-fetch-proxy.sh -vixd)
>
> I.e. this part is new:
>
> remote: Direct leak of 1 byte(s) in 1 object(s) allocated from:
> remote: #0 0x4552f8 in __interceptor_malloc (git+0x4552f8)
> remote: #1 0x75a089 in do_xmalloc wrapper.c:41:8
> remote: #2 0x75a046 in xmalloc wrapper.c:62:9
> remote: #3 0x62c692 in list_objects_filter_copy list-objects-filter-options.c:433:2
> remote: #4 0x4f70bf in get_object_list builtin/pack-objects.c:3730:2
> remote: #5 0x4f5e0e in cmd_pack_objects builtin/pack-objects.c:4157:3
> remote: #6 0x4592ba in run_builtin git.c:465:11
> remote: #7 0x457d71 in handle_builtin git.c:718:3
> remote: #8 0x458ca5 in run_argv git.c:785:4
> remote: #9 0x457b30 in cmd_main git.c:916:19
> remote: #10 0x563179 in main common-main.c:56:11
> remote: #11 0x7fddd2da67ec in __libc_start_main csu/../csu/libc-start.c:332:16
> remote: #12 0x4300e9 in _start (git+0x4300e9)
>
> Of course it's not "new" in the sense that we in effect leaked this
> before, but it was still reachable, you're just changing it so that
> instead of being stored in the static "filter_options" variable in
> pack-objects.c we're storing it in "struct rev_info", which has a
> different lifetime.
True, and 'struct rev_info' is not being release in any way, either,
right?
> I think instead of me rebasing my series on top of yours and tangling
> the two up a better option is to just add a change to this, so after
> list_objects_filter_copy() do:
>
> UNLEAK(revs.filter);
>
> Or, alternatively adding this to the end of the function (in which case
> Junio will need to deal with a minor textual conflict):
>
> list_objects_filter_release(&revs.filter);
>
> Both of those make my series merged with "seen" (which has this change)
> pass with SANITIZE=leak + GIT_TEST_PASSING_SANITIZE_LEAK=true again.
>
> You could do the same in your later change adding
> list_objects_filter_copy() to verify_bundle(), that one also adds a new
> leak, but happens not to cause test failures since the bundle.c code
> isn't otherwise marked as passing with SANITIZE=leak, it fails in
> various other ways.
>
> Obviously we should do something about the actual leak eventually, but
> that can be done in some follow-up work to finish up the missing bits of
> release_revisions(), i.e. adding list_objects_filter_release() etc. to
> release_revisions().
I understand that you like to "show your work" by marking tests as
safe for leak-check by making the smallest changes possible, but your
series has a lot of small patches that do nothing but add a free() or
release_*() call instead of implementing the "right" release_revisions()
from the start.
> So I think just adding UNLEAK() here (and optionally, also to the
> bundle.c code) is the least invasive thing, if you & Junio are OK with
> that approach.
Could you send a patch that does just that, so we are sure to cover
the warnings you are seeing in your tests?
Thanks,
-Stolee
next prev parent reply other threads:[~2022-03-10 13:33 UTC|newest]
Thread overview: 114+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 17:55 [PATCH 00/11] Partial bundles Derrick Stolee via GitGitGadget
2022-02-23 17:55 ` [PATCH 01/11] index-pack: document and test the --promisor option Derrick Stolee via GitGitGadget
2022-02-23 17:55 ` [PATCH 02/11] revision: put object filter into struct rev_info Derrick Stolee via GitGitGadget
2022-03-04 22:15 ` Junio C Hamano
2022-03-07 13:59 ` Derrick Stolee
2022-03-07 16:46 ` Junio C Hamano
2022-02-23 17:55 ` [PATCH 03/11] pack-objects: use rev.filter when possible Derrick Stolee via GitGitGadget
2022-03-04 22:25 ` Junio C Hamano
2022-02-23 17:55 ` [PATCH 04/11] pack-bitmap: drop filter in prepare_bitmap_walk() Derrick Stolee via GitGitGadget
2022-03-04 22:26 ` Junio C Hamano
2022-02-23 17:55 ` [PATCH 05/11] list-objects: consolidate traverse_commit_list[_filtered] Derrick Stolee via GitGitGadget
2022-03-04 22:30 ` Junio C Hamano
2022-02-23 17:55 ` [PATCH 06/11] MyFirstObjectWalk: update recommended usage Derrick Stolee via GitGitGadget
2022-03-04 22:33 ` Junio C Hamano
2022-03-07 14:05 ` Derrick Stolee
2022-03-07 16:47 ` Junio C Hamano
2022-02-23 17:55 ` [PATCH 07/11] bundle: safely handle --objects option Derrick Stolee via GitGitGadget
2022-02-28 16:00 ` Jeff Hostetler
2022-03-04 22:58 ` Junio C Hamano
2022-03-07 14:09 ` Derrick Stolee
2022-03-04 22:57 ` Junio C Hamano
2022-03-07 15:35 ` Ævar Arnfjörð Bjarmason
2022-02-23 17:55 ` [PATCH 08/11] bundle: parse filter capability Derrick Stolee via GitGitGadget
2022-03-07 15:38 ` Ævar Arnfjörð Bjarmason
2022-03-07 16:14 ` Derrick Stolee
2022-03-07 16:22 ` Ævar Arnfjörð Bjarmason
2022-03-07 16:29 ` Derrick Stolee
2022-03-07 15:55 ` Ævar Arnfjörð Bjarmason
2022-02-23 17:55 ` [PATCH 09/11] rev-list: move --filter parsing into revision.c Derrick Stolee via GitGitGadget
2022-02-23 17:55 ` [PATCH 10/11] bundle: create filtered bundles Derrick Stolee via GitGitGadget
2022-03-04 23:35 ` Junio C Hamano
2022-03-07 14:14 ` Derrick Stolee
2022-03-07 16:49 ` Junio C Hamano
2022-03-07 15:44 ` Ævar Arnfjörð Bjarmason
2022-02-23 17:55 ` [PATCH 11/11] bundle: unbundle promisor packs Derrick Stolee via GitGitGadget
2022-03-04 23:43 ` Junio C Hamano
2022-03-07 14:48 ` Derrick Stolee
2022-03-07 16:56 ` Junio C Hamano
2022-03-07 18:57 ` Derrick Stolee
2022-03-07 19:40 ` Junio C Hamano
2022-03-07 19:49 ` Derrick Stolee
2022-03-07 19:54 ` Junio C Hamano
2022-03-07 20:20 ` Derrick Stolee
2022-03-07 21:35 ` Junio C Hamano
2022-03-07 15:47 ` Ævar Arnfjörð Bjarmason
2022-03-07 16:10 ` Derrick Stolee
2022-02-28 17:00 ` [PATCH 00/11] Partial bundles Jeff Hostetler
2022-02-28 17:54 ` Derrick Stolee
2022-03-01 18:03 ` Jeff Hostetler
2022-03-04 19:19 ` Derrick Stolee
2022-03-07 14:55 ` Ævar Arnfjörð Bjarmason
2022-03-07 14:59 ` Derrick Stolee
2022-03-07 21:50 ` [PATCH v2 00/12] " Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 01/12] index-pack: document and test the --promisor option Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 02/12] revision: put object filter into struct rev_info Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 03/12] pack-objects: use rev.filter when possible Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 04/12] pack-bitmap: drop filter in prepare_bitmap_walk() Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 05/12] list-objects: consolidate traverse_commit_list[_filtered] Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 06/12] MyFirstObjectWalk: update recommended usage Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 07/12] bundle: safely handle --objects option Derrick Stolee via GitGitGadget
2022-03-08 9:37 ` Ævar Arnfjörð Bjarmason
2022-03-08 13:45 ` Derrick Stolee
2022-03-08 13:53 ` Ævar Arnfjörð Bjarmason
2022-03-07 21:50 ` [PATCH v2 08/12] bundle: parse filter capability Derrick Stolee via GitGitGadget
2022-03-08 9:25 ` Ævar Arnfjörð Bjarmason
2022-03-08 13:43 ` Derrick Stolee
2022-03-07 21:50 ` [PATCH v2 09/12] rev-list: move --filter parsing into revision.c Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 10/12] bundle: create filtered bundles Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 11/12] bundle: unbundle promisor packs Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 12/12] clone: fail gracefully when cloning filtered bundle Derrick Stolee via GitGitGadget
2022-03-07 22:11 ` [PATCH v2 00/12] Partial bundles Junio C Hamano
2022-03-08 14:39 ` [PATCH v3 " Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 01/12] index-pack: document and test the --promisor option Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 02/12] revision: put object filter into struct rev_info Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 03/12] pack-objects: use rev.filter when possible Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 04/12] pack-bitmap: drop filter in prepare_bitmap_walk() Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 05/12] list-objects: consolidate traverse_commit_list[_filtered] Derrick Stolee via GitGitGadget
2022-03-09 13:24 ` Ævar Arnfjörð Bjarmason
2022-03-08 14:39 ` [PATCH v3 06/12] MyFirstObjectWalk: update recommended usage Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 07/12] list-objects: handle NULL function pointers Ævar Arnfjörð Bjarmason via GitGitGadget
2022-03-08 17:26 ` Junio C Hamano
2022-03-09 13:40 ` Ævar Arnfjörð Bjarmason
2022-03-09 14:16 ` Derrick Stolee
2022-03-09 18:32 ` Junio C Hamano
2022-03-08 14:39 ` [PATCH v3 08/12] bundle: parse filter capability Derrick Stolee via GitGitGadget
2022-03-08 17:29 ` Junio C Hamano
2022-03-09 14:35 ` Derrick Stolee
2022-03-09 13:30 ` Ævar Arnfjörð Bjarmason
2022-03-08 14:39 ` [PATCH v3 09/12] rev-list: move --filter parsing into revision.c Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 10/12] bundle: create filtered bundles Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 11/12] bundle: unbundle promisor packs Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 12/12] clone: fail gracefully when cloning filtered bundle Derrick Stolee via GitGitGadget
2022-03-08 16:10 ` Derrick Stolee
2022-03-08 17:19 ` Junio C Hamano
2022-03-09 16:01 ` [PATCH v4 00/13] Partial bundles Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 01/13] index-pack: document and test the --promisor option Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 02/13] list-objects-filter-options: create copy helper Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 03/13] revision: put object filter into struct rev_info Derrick Stolee via GitGitGadget
2022-03-09 18:48 ` Junio C Hamano
2022-03-09 16:01 ` [PATCH v4 04/13] pack-objects: use rev.filter when possible Derrick Stolee via GitGitGadget
2022-03-10 13:11 ` Ævar Arnfjörð Bjarmason
2022-03-10 13:33 ` Derrick Stolee [this message]
2022-03-10 14:24 ` Ævar Arnfjörð Bjarmason
2022-03-09 16:01 ` [PATCH v4 05/13] pack-bitmap: drop filter in prepare_bitmap_walk() Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 06/13] list-objects: consolidate traverse_commit_list[_filtered] Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 07/13] MyFirstObjectWalk: update recommended usage Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 08/13] list-objects: handle NULL function pointers Ævar Arnfjörð Bjarmason via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 09/13] bundle: parse filter capability Derrick Stolee via GitGitGadget
2022-03-09 18:41 ` Junio C Hamano
2022-03-09 18:55 ` Derrick Stolee
2022-03-09 16:01 ` [PATCH v4 10/13] rev-list: move --filter parsing into revision.c Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 11/13] bundle: create filtered bundles Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 12/13] bundle: unbundle promisor packs Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 13/13] clone: fail gracefully when cloning filtered bundle Derrick Stolee via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=645650c1-7918-6985-a08b-cb47247b08d4@github.com \
--to=derrickstolee@github.com \
--cc=avarab@gmail.com \
--cc=git@jeffhostetler.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=jonathantanmy@google.com \
--cc=stolee@gmail.com \
--cc=zhiyou.jx@alibaba-inc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).