git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What's cooking in git.git (Sep 2018, #04; Thu, 20)

From
René Scharfe <l.s.r@web.de>
Date
Oct 1, 2018, 19:16 UTC
Message-ID
<c5f7009b-53b5-26b9-8a01-b8648ee33a15@web.de>
In-Reply-To
<xmqqin2zxw55.fsf@gitster-ct.c.googlers.com>
Am 21.09.2018 um 07:22 schrieb Junio C Hamano:
Show 13 quoted lines
> * cc/delta-islands (2018-08-16) 7 commits
>   (merged to 'next' on 2018-08-27 at cf3d7bd93f)
>  + pack-objects: move 'layer' into 'struct packing_data'
>  + pack-objects: move tree_depth into 'struct packing_data'
>  + t5320: tests for delta islands
>  + repack: add delta-islands support
>  + pack-objects: add delta-islands support
>  + pack-objects: refactor code into compute_layer_order()
>  + Add delta-islands.{c,h}
> 
>  Lift code from GitHub to restrict delta computation so that an
>  object that exists in one fork is not made into a delta against
>  another object that does not appear in the same forked repository.
Show 15 quoted lines
> * jk/pack-delta-reuse-with-bitmap (2018-08-21) 6 commits
>   (merged to 'next' on 2018-08-22 at fc50b59dab)
>  + pack-objects: reuse on-disk deltas for thin "have" objects
>  + pack-bitmap: save "have" bitmap from walk
>  + t/perf: add perf tests for fetches from a bitmapped server
>  + t/perf: add infrastructure for measuring sizes
>  + t/perf: factor out percent calculations
>  + t/perf: factor boilerplate out of test_perf
>  (this branch is used by jk/pack-objects-with-bitmap-fix.)
> 
>  When creating a thin pack, which allows objects to be made into a
>  delta against another object that is not in the resulting pack but
>  is known to be present on the receiving end, the code learned to
>  take advantage of the reachability bitmap; this allows the server
>  to send a delta against a base beyond the "boundary" commit.

Not sure if it's the interaction of the two topics or if only one of them is to blame, but the result of the merge can dereference a NULL pointer. Found using Clang's UBSan and t5310.

Here's a patch that avoids the issue, but I don't know if it's the right thing to do -- should we rather treat a non-existing base as "not from the same island" instead?

And it's certainly ugly -- that condition is complicated enough already. Splitting it up in a nice way would probably help, but how?

---
 builtin/pack-objects.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index e6316d294d..9abed4a0f0 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1559,7 +1559,8 @@ static void check_object(struct object_entry *entry)
 		    (base_entry = packlist_find(&to_pack, base_ref, NULL)) ||
 		    (thin &&
 		     bitmap_has_sha1_in_uninteresting(bitmap_git, base_ref))) &&
-		    in_same_island(&entry->idx.oid, &base_entry->idx.oid)) {
+		    (!base_entry ||
+		     in_same_island(&entry->idx.oid, &base_entry->idx.oid))) {
 			/*
 			 * If base_ref was set above that means we wish to
 			 * reuse delta data, and either we found that object in
-- 
2.19.0
Previous: Paul-Sebastian UngureanuNext: Jeff King
Message 13 of 15 in “What's cooking in git.git (Sep 2018, #04; Thu, 20)”
  1. Junio C HamanoSep 21, 2018
  2. Segfault in master due to 4fbcca4effÆvar Arnfjörð Bjarmason, Sep 21, 2018
  3. Derrick StoleeSep 21, 2018
  4. Ævar Arnfjörð BjarmasonSep 21, 2018
  5. Derrick StoleeSep 21, 2018
  6. Junio C HamanoSep 21, 2018
  7. Ævar Arnfjörð BjarmasonSep 21, 2018
  8. Jeff KingSep 21, 2018
  9. Ævar Arnfjörð BjarmasonSep 21, 2018
  10. Johannes SixtSep 21, 2018
  11. Junio C HamanoSep 21, 2018
  12. Paul-Sebastian UngureanuSep 23, 2018
  13. René ScharfeOct 1, 2018
  14. Jeff KingOct 1, 2018
  15. René ScharfeOct 1, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.