From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Pierre Habouzit <madcoder@debian.org>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
spearce@spearce.org, Git ML <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] index-pack: never prune base_cache.
Date: Wed, 23 Jul 2008 14:52:26 +0200 [thread overview]
Message-ID: <20080723125226.GA11679@atjola.homenet> (raw)
In-Reply-To: <20080723121118.GA20614@artemis.madism.org>
On 2008.07.23 14:11:18 +0200, Pierre Habouzit wrote:
> It may belong to something (stdin) that is consumed.
Probably thanks to me, babbling about stdin without having a clue what
I'm talking about, that rationale is wrong.
We may not prune base_cache since that object might come from a
different pack than the one that we are processing. In such a case, we
would try to restore the data for that object from the pack we're
processing and fail miserably.
The patch itself should be fine.
>
> Signed-off-by: Pierre Habouzit <madcoder@debian.org>
> ---
>
> On Wed, Jul 23, 2008 at 12:00:45PM +0000, Björn Steinbrink wrote:
> > On 2008.07.23 12:37:00 +0100, Johannes Schindelin wrote:
> > > Hi,
> > >
> > > Well, I cannot. However, I get some pread issue on i686. To be nice to
> > > kernel.org, I downloaded the pack in question:
> > >
> > > http://pacific.mpi-cbg.de/git/thin-pack.pack
> > >
> > > You should be able to reproduce the behavior by piping this into
> > >
> > > git-index-pack --stdin -v --fix-thin --keep=fetch-pack --pack_header=2,263
> >
> > OK, that gave me a seemingly sane backtrace. What seems to happen (AFA
> > my limited knowledge tells me):
> >
> > In fix_unresolved_deltas, we read base_obj from an existing pack, other
> > than the one we're reading. We then link that object to the base cache.
> >
> > Then in resolve_delta, we create the "result" base_data object and link
> > that one, too. Now this triggers the pruning, and because the cache is
> > so small, we prune the object that we read from the existing pack! Fast
> > forward a few function calls, we end up in get_base_data trying to
> > re-read the data for that object, but this time from the pack that we
> > got on stdin. And boom it goes.
> >
> > Does that make any sense to you?
>
> Yes, that's obvious, the pack that we read from stdin is consumed, we
> should *NEVER* prune base_cache. And indeed that little patch works for
> me.
>
> index-pack.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/index-pack.c b/index-pack.c
> index ac20a46..eb81ed4 100644
> --- a/index-pack.c
> +++ b/index-pack.c
> @@ -227,7 +227,7 @@ static void prune_base_data(struct base_data *retain)
> for (b = base_cache;
> base_cache_used > delta_base_cache_limit && b;
> b = b->child) {
> - if (b->data && b != retain) {
> + if (b != base_cache && b->data && b != retain) {
> free(b->data);
> b->data = NULL;
> base_cache_used -= b->size;
next prev parent reply other threads:[~2008-07-23 12:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-22 23:17 regression in 92392b4 Pierre Habouzit
2008-07-22 23:34 ` Johannes Schindelin
2008-07-23 0:41 ` Shawn O. Pearce
2008-07-23 0:58 ` Johannes Schindelin
2008-07-23 1:09 ` Pierre Habouzit
2008-07-23 1:20 ` Johannes Schindelin
2008-07-22 23:37 ` Pierre Habouzit
2008-07-23 10:14 ` Björn Steinbrink
2008-07-23 10:22 ` Pierre Habouzit
2008-07-23 10:38 ` Pierre Habouzit
2008-07-23 10:49 ` Johannes Schindelin
2008-07-23 10:56 ` Björn Steinbrink
2008-07-23 11:19 ` Pierre Habouzit
2008-07-23 11:37 ` Johannes Schindelin
2008-07-23 11:50 ` Pierre Habouzit
2008-07-23 12:00 ` Björn Steinbrink
2008-07-23 12:11 ` [PATCH] index-pack: never prune base_cache Pierre Habouzit
2008-07-23 12:52 ` Björn Steinbrink [this message]
2008-07-23 13:09 ` Johannes Schindelin
2008-07-23 13:20 ` Pierre Habouzit
2008-07-23 13:46 ` Johannes Schindelin
2008-07-23 13:44 ` Björn Steinbrink
2008-07-23 14:41 ` Johannes Schindelin
2008-07-23 15:30 ` Pierre Habouzit
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080723125226.GA11679@atjola.homenet \
--to=b.steinbrink@gmx.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=madcoder@debian.org \
--cc=spearce@spearce.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox