brz info: KeyError in git repository

Bug #1796218 reported by Aaron Bentley on 2018-10-05
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Breezy
Critical
Jelmer Vernooij

Bug Description

$ brz info
brz: ERROR: KeyError: 'cc908f20046b3d116725d4c248c5faf7a3eb70e0'
Traceback (most recent call last):
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/commands.py", line 1009, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/commands.py", line 1194, in run_bzr
    ret = run(*run_argv)
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/commands.py", line 760, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/commands.py", line 784, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/commands.py", line 1211, in ignore_pipe
    result = func(*args, **kwargs)
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/builtins.py", line 1844, in run
    verbose=noise_level, outfile=self.outf)
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/info.py", line 354, in show_bzrdir_info
    recommend_upgrade=False)
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/git/dir.py", line 593, in open_workingtree
    return GitWorkingTree(self, repo, branch)
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/git/workingtree.py", line 122, in __init__
    self._reset_data()
  File "/home/abentley/.local/lib/python2.7/site-packages/breezy/git/workingtree.py", line 677, in _reset_data
    self.store.__getitem__, self.store[head].tree)
  File "/home/abentley/.local/lib/python2.7/site-packages/dulwich/object_store.py", line 119, in __getitem__
    type_num, uncomp = self.get_raw(sha)
  File "/home/abentley/.local/lib/python2.7/site-packages/dulwich/object_store.py", line 461, in get_raw
    raise KeyError(hexsha)
KeyError: 'cc908f20046b3d116725d4c248c5faf7a3eb70e0'

brz 3.0a1 on python 2.7.15rc1 (Linux-4.15.0-36-generic-x86_64-with-
    Ubuntu-18.04-bionic)
arguments: ['/home/abentley/.local/bin/brz', 'info']
plugins: bash_completion[3.0a1], bzrtools[2.6.0], changelog_merge[3.0a1],
    commitfromnews[unknown], cvs[3.0a1], darcs[unknown], email[unknown],
    fastimport[unknown], hide[unknown], launchpad[3.0a1], loggerhead[1.18.1],
    lpreview_body[unknown], mtn[3.0a1], netrc_credential_store[3.0a1],
    news_merge[3.0a1], openlookup[unknown], pipeline[1.5.0], po_merge[3.0a1],
    repodebug[unknown], stats[3.0a1], trigger_scan[unknown], upload[3.0a1],
    weave_fmt[3.0a1]
encoding: 'utf-8', fsenc: 'UTF-8', lang: 'en_CA.UTF-8'

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/brz/+filebug
    including this traceback and a description of the problem.

Related branches

Aaron Bentley (abentley) on 2018-10-05
summary: - bzr info: KeyError in git repository
+ brz info: KeyError in git repository
Jelmer Vernooij (jelmer) wrote :

Does running "git cat-file -p cc908f20046b3d116725d4c248c5faf7a3eb70e0" in that repository work, and what kind of object does it return?

What about "brz git-refs | grep cc908f20046b3d116725d4c248c5faf7a3eb70e0" ?

Changed in brz:
status: New → Triaged
importance: Undecided → Critical
milestone: none → 3.0.0
Aaron Bentley (abentley) wrote :

git cat-file -p cc908f20046b3d116725d4c248c5faf7a3eb70e0 works. It returns a commit log with tree, parent, author, committer and a message body. Unfortunately, this is proprietary code, so I can't post it.

brz git-refs | grep cc908f20046b3d116725d4c248c5faf7a3eb70e0
HEAD -> cc908f20046b3d116725d4c248c5faf7a3eb70e0
refs/heads/feature/SPLM-1934-integration-test-7814 -> cc908f20046b3d116725d4c248c5faf7a3eb70e0
refs/remotes/origin/feature/SPLM-1934-integration-test-7814 -> cc908f20046b3d116725d4c248c5faf7a3eb70e0

On Fri, Oct 05, 2018 at 03:07:04AM -0000, Aaron Bentley wrote:
> git cat-file -p cc908f20046b3d116725d4c248c5faf7a3eb70e0 works. It
> returns a commit log with tree, parent, author, committer and a message
> body. Unfortunately, this is proprietary code, so I can't post it.
>
> brz git-refs | grep cc908f20046b3d116725d4c248c5faf7a3eb70e0
> HEAD -> cc908f20046b3d116725d4c248c5faf7a3eb70e0
> refs/heads/feature/SPLM-1934-integration-test-7814 -> cc908f20046b3d116725d4c248c5faf7a3eb70e0
> refs/remotes/origin/feature/SPLM-1934-integration-test-7814 -> cc908f20046b3d116725d4c248c5faf7a3eb70e0

Hmm, odd. I'm not hitting this on Git repositories. Is there something
special about the git repository, i.e. a non-custom option that was
set during creation? Shallow branch, that sort of thing?

Does running "dulwich log" in the repository work?

Is .git a file or a directory?

Do any of the following files exist?
.git/info/alternates
.git/info/packs

Jelmer

--
Jelmer Vernooij <email address hidden>
PGP Key: https://www.jelmer.uk/D729A457.asc

Jelmer Vernooij (jelmer) wrote :

On Fri, Oct 05, 2018 at 09:03:33AM +0100, Jelmer Vernooij wrote:
> On Fri, Oct 05, 2018 at 03:07:04AM -0000, Aaron Bentley wrote:
> > git cat-file -p cc908f20046b3d116725d4c248c5faf7a3eb70e0 works. It
> > returns a commit log with tree, parent, author, committer and a message
> > body. Unfortunately, this is proprietary code, so I can't post it.
> >
> > brz git-refs | grep cc908f20046b3d116725d4c248c5faf7a3eb70e0
> > HEAD -> cc908f20046b3d116725d4c248c5faf7a3eb70e0
> > refs/heads/feature/SPLM-1934-integration-test-7814 -> cc908f20046b3d116725d4c248c5faf7a3eb70e0
> > refs/remotes/origin/feature/SPLM-1934-integration-test-7814 -> cc908f20046b3d116725d4c248c5faf7a3eb70e0
>
> Hmm, odd. I'm not hitting this on Git repositories. Is there something
> special about the git repository, i.e. a non-custom option that was
> set during creation? Shallow branch, that sort of thing?
>
> Does running "dulwich log" in the repository work?
>
> Is .git a file or a directory?
>
> Do any of the following files exist?
> .git/info/alternates
> .git/info/packs

Sorry, .git/objects/info/alternates and .git/objects/info/packs

Aaron Bentley (abentley) wrote :

It is a git-lfs-enabled repo, but I tested with a different git-lfs-enabled repo and that one worked fine.

.git is a directory.

$ ls .git/objects/info
packs

Jelmer Vernooij (jelmer) on 2018-10-05
Changed in brz:
assignee: nobody → Jelmer Vernooij (jelmer)
status: Triaged → Fix Committed
Jelmer Vernooij (jelmer) wrote :

On Fri, Oct 05, 2018 at 01:16:38PM -0000, Aaron Bentley wrote:
> It is a git-lfs-enabled repo, but I tested with a different git-lfs-
> enabled repo and that one worked fine.
>
> .git is a directory.
>
> $ ls .git/objects/info
> packs
Ah, okay - that explains it.

"git update-server-info" was run in this repository at some point, but
not recently.

Breezy incorrectly checks the .git/objects/info/packs file *before*
attempting to just call os.listdir('git/objects/packs'). It should be
the other way around.

Jelmer Vernooij (jelmer) on 2018-10-14
Changed in brz:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers