Thread (4 messages) flat view 4 messages, 3 authors, 2021-05-06

Re: [PATCH] builtin/init-db: preemptively clear repo_fmt to avoid leaks

From: Johannes Schindelin <hidden>
Date: 2021-05-05 19:28:34

Hi Andrzej,

On Wed, 5 May 2021, Andrzej Hunt via GitGitGadget wrote:
quoted hunk ↗ jump to hunk
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 31b718259a64..b25147ebaf59 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -512,6 +512,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
 			       git_dir, len && git_dir[len-1] != '/' ? "/" : "");
 	}

+	clear_repository_format(&repo_fmt);
I am afraid that this might not be correct, as t0410.27 experienced a
segmentation fault (see
https://github.com/git/git/pull/1018/checks?check_run_id=2511749719#step:5:2845
for the full details):

-- snip --
[...]
 + repack_and_check -a bd6a66906d425462f8fbf1e3a61cda48cc4e456c
3251618c5193c77083052fb7d6ed5e8b0b227a94
+ rm -rf repo2
+ cp -r repo repo2
+ git -C repo2 repack -a -d
warning: reflog of 'HEAD' references pruned commits
warning: reflog of 'refs/heads/master' references pruned commits
Segmentation fault (core dumped)
error: last command exited with $?=139
not ok 27 - repack -d does not irreversibly delete promisor objects
-- snap --

When I encountered similar problems with my patches in the past, I found
the `--valgrind-only` option incredibly useful, i.e. something like

	cd t && sh t0410-*.sh -i -v -x --valgrind-only=27

Maybe you can give it a try?

Ciao,
Dscho
 	free(original_git_dir);
 	return 0;
 }

base-commit: c3901c8daf043cdc16ffb20d3a410f3a2d5494fd
--
gitgitgadget
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help