git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Christian Couder <christian.couder@gmail.com>,
	Thomas Gummerer <t.gummerer@gmail.com>, git <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] cache-tree: reject entries with null sha1
Date: Mon, 24 Apr 2017 17:39:33 +0700	[thread overview]
Message-ID: <CACsJy8AAtV5KJHBqWvnYb3Mw9CVzEdG3M-UJA+jd5MR5e-UMsA@mail.gmail.com> (raw)
In-Reply-To: <20170421184617.lc5bioa5px6ninrj@sigill.intra.peff.net>

On Sat, Apr 22, 2017 at 1:46 AM, Jeff King <peff@peff.net> wrote:
> We generally disallow null sha1s from entering the index,
> due to 4337b5856 (do not write null sha1s to on-disk index,
> 2012-07-28). However, we loosened that in 83bd7437c
> (write_index: optionally allow broken null sha1s,
> 2013-08-27) so that tools like filter-branch could be used
> to repair broken history.

Uh oh.. cache-tree.

> However, we should make sure that these broken entries do
> not get propagated into new trees. For most entries, we'd
> catch them with the missing-object check (since presumably
> the null sha1 does not exist in our object database). But
> gitlink entries do not need reachability, so we may blindly
> copy the entry into a bogus tree.

Phew.. not another bug of mine :D

> When merged to pu, this fixes the existing test breakage in t7009 when
> GIT_TEST_SPLIT_INDEX is used (because the split index didn't rewrite the
> whole index, "git rm --cached" didn't always barf).

Latest 'pu' has your patch, but t7009 still fails on me (with "invalid
object" error), more on this later..

> But I think it's worth doing on its own merits, as demonstrated by the new tests.

Agreed. The patch looks correct.

Just checking, since cache-tree helps speed up many operations,
dropping cache-tree can have some performance implication. But this
must be an error case (null sha1) and we will not run into it often to
worry about unnecessary dropping, correct?

> The one thing I haven't figured out it is why the new test in t7009
> fails with the split-index. And even more curiously, the new tests in
> t1601 _don't_ fail with it, even if I instrument the fake index to have
> more entries (making it more likely to split).

back to t7009 failure. I'll see if I can look more into this this
weekend. If split-index somehow produces these null sha1, then I
probably have a problem.

Thanks for looking at it anyway. One bug down. Thousands to go...

BTW, I ran t7009 with valgrind and it reported this. Is it something
we should be worried about? I vaguely recall you're doing something
with prio-queue...

==4246== Source and destination overlap in memcpy(0x5952990, 0x5952990, 16)
==4246==    at 0x4C2EACD: memcpy@@GLIBC_2.14 (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4246==    by 0x545D05: swap (prio-queue.c:15)
==4246==    by 0x545D72: prio_queue_reverse (prio-queue.c:25)
==4246==    by 0x4CBC0C: sort_in_topological_order (commit.c:723)
==4246==    by 0x574C97: prepare_revision_walk (revision.c:2858)
==4246==    by 0x48A2BA: cmd_rev_list (rev-list.c:385)
==4246==    by 0x405A6F: run_builtin (git.c:371)
==4246==    by 0x405CDC: handle_builtin (git.c:572)
==4246==    by 0x405E51: run_argv (git.c:624)
==4246==    by 0x405FF3: cmd_main (git.c:701)
==4246==    by 0x4A48CE: main (common-main.c:43)
-- 
Duy

  reply	other threads:[~2017-04-24 10:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21 18:46 [PATCH] cache-tree: reject entries with null sha1 Jeff King
2017-04-24 10:39 ` Duy Nguyen [this message]
2017-04-24 11:13   ` Jeff King
2017-05-01 11:23   ` René Scharfe
2017-05-01 11:55     ` René Scharfe
2017-05-01 19:22     ` Jeff King
2017-05-01 21:00       ` René Scharfe
2017-05-01 21:26         ` Jeff King
2017-05-03  9:46       ` Duy Nguyen
2017-05-03 19:48         ` René Scharfe

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACsJy8AAtV5KJHBqWvnYb3Mw9CVzEdG3M-UJA+jd5MR5e-UMsA@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=t.gummerer@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).