From 970d5bf11bc96cd6974bf7665d67e1174abe3750 Mon Sep 17 00:00:00 2001 From: Brandon Low Date: Tue, 8 Feb 2011 10:43:22 -0800 Subject: [PATCH] midx4: Fix name offsets when generated from idx This was a nasty bug, glad it got found before release. Only effected the server's ability to suggest .idxs so far, but would have effected any attempt to have bup retrieve objects directly too. Signed-off-by: Brandon Low --- lib/bup/_helpers.c | 5 ++++- lib/bup/git.py | 2 +- lib/bup/t/tgit.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/lib/bup/_helpers.c b/lib/bup/_helpers.c index 938b7a3..0af9411 100644 --- a/lib/bup/_helpers.c +++ b/lib/bup/_helpers.c @@ -330,7 +330,10 @@ static PyObject *merge_into(PyObject *self, PyObject *args) return NULL; idxs[i]->cur = (struct sha *)&idxs[i]->map[sha_ofs]; idxs[i]->end = &idxs[i]->cur[len]; - idxs[i]->cur_name = (uint32_t *)&idxs[i]->map[name_map_ofs]; + if (name_map_ofs) + idxs[i]->cur_name = (uint32_t *)&idxs[i]->map[name_map_ofs]; + else + idxs[i]->cur_name = NULL; } table_ptr = (uint32_t *)&fmap[12]; sha_ptr = (struct sha *)&table_ptr[1<