# git bundle verify segfaults

2 messages from 2019-05-24 to 2019-05-24. Participants: Konstantin Ryabitsev, SZEDER Gábor.
Thread: https://gitlist.dev/t/51171

## Konstantin Ryabitsev, 2019-05-24 17:48

Subject: git bundle verify segfaults
Message-ID: <20190524174835.GA2068@chatter.i7.local>
URL: https://gitlist.dev/e/20190524174835.GA2068%40chatter.i7.local

```
Hello:

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 --version
git version 2.21.0

Best,
-K

```

## SZEDER Gábor, 2019-05-24 18:49

Subject: Re: git bundle verify segfaults
Message-ID: <20190524184922.GJ951@szeder.dev>
URL: https://gitlist.dev/e/20190524184922.GJ951%40szeder.dev
In-Reply-To: <20190524174835.GA2068@chatter.i7.local>

```
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...



```
