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

Re: [PATCH v3] multi-pack-index: fix *.rev cleanups with --object-dir

From
Johannes Berg <johannes@sipsolutions.net>
Date
Aug 24, 2021, 07:59 UTC
Message-ID
<f398645c2c946ea0d7cc6d8f603962dde5f7c4e0.camel@sipsolutions.net>
In-Reply-To
<xmqqeeajpyrc.fsf@gitster.g>
On Mon, 2021-08-23 at 15:44 -0700, Junio C Hamano wrote:
Show 17 quoted lines
> Johannes Berg <johannes@sipsolutions.net> writes:
> 
> > If using --object-dir to point into a repo while the current
> > working dir is outside, such as
> > 
> >   git init /repo
> >   git -C /repo ... # add some objects
> >   cd /non-repo
> >   git multi-pack-index --object-dir /repo/.git/objects/ write
> > 
> > the binary will segfault trying to access the object-dir via
> > the repo it found, but that's not fully initialized. Fix it
> 
> OK, so write_midx_internal() was given an object_dir to work in,
> made various changes to that directory, but at the very end of the
> sequence, instead of clearing the revindex in the object_dir we have
> been working in, cleared the odb associated with the repository.

I'm not sure I'd claim "cleared the odb" but it's also not entirely clear to me what you mean by that.

Specifically, what happened is that it cleared out all the .rev files in the objects/pack folder associated with the repository. And if there wasn't actually a repository, it would NULL-ptr-deref instead.

Feel free to rewrite the commit log, or I can if you really want me to. I was more concerned with the segfault, but I can also understand that you'd be more concerned with the on-disk correctness issue this causes.

johannes
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 6 in “multi-pack-index: fix *.rev cleanups with --object-dir”
  1. multi-pack-index: fix *.rev cleanups with --object-dirJohannes Berg, Aug 23, 2021
  2. Junio C HamanoAug 23, 2021
  3. Johannes BergAug 24, 2021
  4. Junio C HamanoAug 24, 2021
  5. Taylor BlauAug 24, 2021
  6. Johannes BergAug 24, 2021

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.