Web lists-archives.com

Re: git bundle verify segfaults




On Fri, May 24, 2019 at 01:48:35PM -0400, Konstantin Ryabitsev wrote:
> I seem to be getting a segfault trying to verify bundles created from
> linux.git. It's easy to reproduce:
> 
> $ cd linux
> $ git show-ref master
> c50bbf615f2f0028ad1771506ef8807130ccc2ce refs/heads/master
> $ git bundle create /tmp/linux.bundle master
> Enumerating objects: 6705678, done.
> Counting objects: 100% (6705678/6705678), done.
> Delta compression using up to 8 threads
> Compressing objects: 100% (1037089/1037089), done.
> Writing objects: 100% (6705678/6705678), 1.19 GiB | 97.81 MiB/s, done.
> Total 6705678 (delta 5657955), reused 6664576 (delta 5622679)
> $ cd /tmp
> $ git bundle verify linux.bundle
> BUG: refs.c:1750: attempting to get main_ref_store outside of repository
> Aborted (core dumped)

'git bundle verify' needs a repository to check "that the prerequisite
commits exist and are fully linked in the current repository" (quoting
its manpage).  I presume your '/tmp' is not a git repository, so Git
complains, though it definitely shouldn't just BUG(), but rather say
"fatal: not a git repository (or any of the parent directories): .git"
instead.

However, if the bundle is self-contained (like the one you created
above), then there are no prerequisite commits to check, and a
repository is not strictly necessary to verify the bundle's integrity,
so 'git bundle verify' could actually get the job done even outside of
a repository.  And it used to work until commit b1ef400eec
(setup_git_env: avoid blind fall-back to ".git", 2016-10-20), so I add
Peff to Cc...