Re: [PATCH 1/2] sequencer: stop exporting GIT_REFLOG_ACTION
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Nov 8, 2022, 09:54 UTC
- Message-ID
- <16baa0cd-0797-4427-3e39-e5ffd2dca544@dunelm.org.uk>
- In-Reply-To
- <03cd4cdb-5f6b-11b9-1959-d58d5b544565@dunelm.org.uk>
Hi Ævar
On 07/11/2022 19:35, Phillip Wood wrote:
Show 10 quoted lines
>>> @@ -5116,7 +5121,7 @@ static int single_pick(struct repository *r, >>> TODO_PICK : TODO_REVERT; >>> item.commit = cmit; >>> - setenv(GIT_REFLOG_ACTION, action_name(opts), 0); >>> + opts->reflog_message = sequencer_reflog_action(opts); >>> return do_pick_commit(r, &item, opts, 0, &check_todo); >> >> Here you're adding a new memory leak, which you can see if you run >> e.g. the 1st test of ./t1013-read-tree-submodule.sh before & after this >> change.
What's a read-tree test using rebase for? I find the submodule tests completely incomprehensible. It is calling test_submodule_switch_recursing_with_args() which does not call rebase directly but who knows what is going on in all the helper functions. Have you got a simple example of a test which shows a new leak?
> I'm not sure how, opts->reflog_message will be a copy of > opts->reflog_action which is freed at the end of the rebase. I'll have a > proper look tomorrow to see if I'm missing something.
So it is possible this is showing up because I think we only free the heap allocated members of opts in sequencer_remove_state() and that is not called when we stop for a conflict resolution, a break command, a failed exec or a rescheduled pick/reset etc. The way to fix that would be to refactor sequencer_remove_state() to create replay_opts_release() and call that from builtin/{revert,rebase}.c
As that is unrelated to removing the setenv() calls which is the focus of this series I will not be doing that in this series.
> Best Wishes > > Phillip