Reads first 2 bytes more than once

Bug #588724 reported by Neil Martinsen-Burrell
48
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Bazaar Git Plugin
Fix Released
Low
Jelmer Vernooij
Dulwich
Fix Released
Low
Jelmer Vernooij
Launchpad itself
Fix Released
Medium
Jelmer Vernooij

Bug Description

I got the following crash while trying to branch from the public git mirror of the Scipy project

$ bzr branch http://projects.scipy.org/git/scipy.git scipy-git-bzr
bzr: ERROR: exceptions.ValueError: need more than 0 values to unpack

Traceback (most recent call last):
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/commands.py", line 909, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/commands.py", line 1107, in run_bzr
    ret = run(*run_argv)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/commands.py", line 687, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/commands.py", line 702, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/cleanup.py", line 122, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/cleanup.py", line 156, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/builtins.py", line 1216, in run
    revision_id = br_from.last_revision()
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/decorators.py", line 140, in read_locked
    result = unbound(self, *args, **kwargs)
  File "/Users/nmb/.bazaar/plugins/git/branch.py", line 250, in last_revision
    return self.lookup_foreign_revision_id(self.head)
  File "/Users/nmb/.bazaar/plugins/git/branch.py", line 258, in lookup_foreign_revision_id
    self.mapping)
  File "/Users/nmb/.bazaar/plugins/git/repository.py", line 172, in lookup_foreign_revision_id
    commit = self._git[foreign_revid]
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/dulwich-0.6.0-py2.6-macosx-10.3-fat.egg/dulwich/repo.py", line 981, in __getitem__
    return self.object_store[name]
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/dulwich-0.6.0-py2.6-macosx-10.3-fat.egg/dulwich/object_store.py", line 104, in __getitem__
    type_num, uncomp = self.get_raw(sha)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/dulwich-0.6.0-py2.6-macosx-10.3-fat.egg/dulwich/object_store.py", line 312, in get_raw
    return ret.type_num, ret.as_raw_string()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/dulwich-0.6.0-py2.6-macosx-10.3-fat.egg/dulwich/objects.py", line 226, in as_raw_string
    return "".join(self.as_raw_chunks())
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/dulwich-0.6.0-py2.6-macosx-10.3-fat.egg/dulwich/objects.py", line 220, in as_raw_chunks
    self._ensure_parsed()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/dulwich-0.6.0-py2.6-macosx-10.3-fat.egg/dulwich/objects.py", line 241, in _ensure_parsed
    self._parse_file(self._file)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/dulwich-0.6.0-py2.6-macosx-10.3-fat.egg/dulwich/objects.py", line 326, in _parse_file
    if self._is_legacy_object(magic):
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/dulwich-0.6.0-py2.6-macosx-10.3-fat.egg/dulwich/objects.py", line 290, in _is_legacy_object
    b0, b1 = map(ord, magic)
ValueError: need more than 0 values to unpack

bzr 2.2.0dev1 on python 2.6.5 (Darwin-9.8.0-i386-32bit)
arguments: ['/Users/nmb/usr/bin/bzr', 'branch', 'http://projects.scipy.org/git/scipy.git', 'scipy-git-bzr']
encoding: 'UTF-8', fsenc: 'utf-8', lang: 'en_US.UTF-8'
plugins:
  automirror /Users/nmb/.bazaar/plugins/automirror [0.1.0]
  bash_completion /Users/nmb/src/bzr/bzr.dev/bzrlib/plugins/bash_completion [2.2.0dev1]
  bzrtools /Users/nmb/.bazaar/plugins/bzrtools [2.2.0]
  colo /Users/nmb/.bazaar/plugins/colo [0.2.0dev]
  explorer /Users/nmb/.bazaar/plugins/explorer [1.1.0dev]
  fastimport /Users/nmb/.bazaar/plugins/fastimport [0.9.0dev]
  git /Users/nmb/.bazaar/plugins/git [0.5.1]
  hg /Users/nmb/.bazaar/plugins/hg [0.2.0dev]
  latex_version_info /Users/nmb/.bazaar/plugins/latex_version_info [0.0.2]
  launchpad /Users/nmb/src/bzr/bzr.dev/bzrlib/plugins/launchpad [2.2.0dev1]
  netrc_credential_store /Users/nmb/src/bzr/bzr.dev/bzrlib/plugins/netrc_credential_store [2.2.0dev1]
  news_merge /Users/nmb/src/bzr/bzr.dev/bzrlib/plugins/news_merge [2.2.0dev1]
  qbzr /Users/nmb/.bazaar/plugins/qbzr [0.19.0dev1]
  rst2html /Users/nmb/.bazaar/plugins/rst2html [0.0.2]

$ python -c "import dulwich; print dulwich.__version__"
(0, 6, 0)
$ python --version
Python 2.6.5

Tags: lp-code qa-ok

Related branches

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: ValueError rather than ObjectFormatException on empty file

Dulwich should raise a better exception if it encounters an empty ShaFile.

Changed in bzr-git:
status: New → Triaged
affects: bzr-git → dulwich
Changed in dulwich:
importance: Undecided → Low
summary: - Crash on branch: ValueError: need more than 0 values to unpack
+ ValueError rather than ObjectFormatException on empty file
Jelmer Vernooij (jelmer)
summary: - ValueError rather than ObjectFormatException on empty file
+ Reads first 2 bytes more than once
Changed in bzr-git:
status: New → Triaged
importance: Undecided → Low
Changed in launchpad-code:
status: New → Triaged
importance: Undecided → Medium
Jelmer Vernooij (jelmer)
Changed in dulwich:
milestone: none → 0.6.1
assignee: nobody → Jelmer Vernooij (jelmer)
Jelmer Vernooij (jelmer)
Changed in bzr-git:
status: Triaged → Fix Committed
Changed in dulwich:
status: Triaged → Fix Committed
Jelmer Vernooij (jelmer)
Changed in dulwich:
status: Fix Committed → Fix Released
Revision history for this message
Peter Bex (peter-bex) wrote :

When will this be rolled out to Launchpad?

Jelmer Vernooij (jelmer)
Changed in bzr-git:
milestone: none → 0.5.2
Jelmer Vernooij (jelmer)
Changed in bzr-git:
status: Fix Committed → Fix Released
Jelmer Vernooij (jelmer)
Changed in bzr-git:
assignee: nobody → Jelmer Vernooij (jelmer)
Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit
Changed in bzr-git:
milestone: 0.5.2 → none
tags: added: qa-needstesting
Ursula Junque (ursinha)
Changed in launchpad-code:
assignee: nobody → Jelmer Vernooij (jelmer)
status: Triaged → Fix Committed
Revision history for this message
Ursula Junque (ursinha) wrote :
Jelmer Vernooij (jelmer)
Changed in launchpad-code:
milestone: none → 10.09
Tim Penhey (thumper)
tags: added: qa-ok
removed: qa-needstesting
Curtis Hovey (sinzui)
Changed in launchpad-code:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.