Inventories get added with different parents

Bug #388470 reported by Jelmer Vernooij
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar Subversion Plugin
Fix Released
High
Jelmer Vernooij

Bug Description

  affects bzr
  status triaged
  importance high

When adding the same inventory twice, Bazaar crashes:

bzr: ERROR: bzrlib.errors.KnitCorrupt: Knit
<bzrlib.groupcompress._GCGraphIndex object at 0x36de5d0> corrupt:
inconsistent details in add_recor
ds: ('269 230 0 295', ((),)) ('269 230 0 295', ([],))

Traceback (most recent call last):
  File "/home/jelmer/bzr/bzr.dev/bzrlib/commands.py", line 831, in
exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/home/jelmer/bzr/bzr.dev/bzrlib/commands.py", line 1026, in
run_bzr
    ret = run(*run_argv)
  File "/home/jelmer/bzr/bzr.dev/bzrlib/commands.py", line 643, in
run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/jelmer/.bazaar/dev-plugins/svn/commands.py", line 177,
in run
    to_revnum=to_revnum, prefix=prefix)
  File "/home/jelmer/.bazaar/dev-plugins/svn/convert.py", line 371, in
convert_repository
    RepositoryConverter(*args, **kwargs)
  File "/home/jelmer/.bazaar/dev-plugins/svn/convert.py", line 248, in
__init__
    revfinder, mapping, heads)
  File "/home/jelmer/.bazaar/dev-plugins/svn/convert.py", line 296, in
_fetch_to_shared_repo
    inter.fetch(needed=revfinder.get_missing())
  File "/home/jelmer/.bazaar/dev-plugins/svn/fetch.py", line 1260, in
fetch
    use_replay=self._use_replay)
  File "/home/jelmer/.bazaar/dev-plugins/svn/fetch.py", line 1191, in
_fetch_revisions
    parent_revmeta)
  File "/home/jelmer/.bazaar/dev-plugins/svn/fetch.py", line 1136, in
_fetch_revision_switch
    report_inventory_contents(reporter, parent_revnum, start_empty)
  File "/home/jelmer/.bazaar/dev-plugins/svn/errors.py", line 129, in
convert
    return unbound(*args, **kwargs)
  File "/home/jelmer/.bazaar/dev-plugins/svn/fetch.py", line 903, in
report_inventory_contents
    reporter.finish()
  File "/home/jelmer/.bazaar/dev-plugins/svn/fetch.py", line 285, in close
    self._close()
  File "/home/jelmer/.bazaar/dev-plugins/svn/fetch.py", line 446, in
_close
    self.editor._finish_commit()
  File "/home/jelmer/.bazaar/dev-plugins/svn/fetch.py", line 682, in
_finish_commit
    tuple([r for r in rev.parent_ids if r in
self.target.has_revisions(rev.parent_ids)]))
  File
"/home/jelmer/bzr/bzr.dev/bzrlib/repofmt/groupcompress_repo.py", line
704, in add_inventory_by_delta
    basis_revision_id, delta, new_revision_id, parents)
  File "/home/jelmer/bzr/bzr.dev/bzrlib/repository.py", line 1065, in
add_inventory_by_delta
    return (self.add_inventory(new_revision_id, basis_inv, parents),
  File "/home/jelmer/bzr/bzr.dev/bzrlib/repository.py", line 1013, in
add_inventory
    return self._add_inventory_checked(revision_id, inv, parents)
  File
"/home/jelmer/bzr/bzr.dev/bzrlib/repofmt/groupcompress_repo.py", line
675, in _add_inventory_checked
    inv_lines, check_content=False)
  File "/home/jelmer/bzr/bzr.dev/bzrlib/repository.py", line 1075, in
_inventory_add_lines
    check_content=check_content)[0]
  File "/home/jelmer/bzr/bzr.dev/bzrlib/groupcompress.py", line 1008,
in add_lines
    nostore_sha=nostore_sha))[0]
  File "/home/jelmer/bzr/bzr.dev/bzrlib/groupcompress.py", line 1500,
in _insert_record_stream
    flush()
  File "/home/jelmer/bzr/bzr.dev/bzrlib/groupcompress.py", line 1402,
in flush
    self._index.add_records(nodes, random_id=random_id)
  File "/home/jelmer/bzr/bzr.dev/bzrlib/groupcompress.py", line 1620,
in add_records
    ": %s %s" % ((value, node_refs), keys[key]))
KnitCorrupt: Knit <bzrlib.groupcompress._GCGraphIndex object at
0x36de5d0> corrupt: inconsistent details in add_records: ('269 230 0
295', ((),)) ('269 230 0 295', ([],))

bzr 1.17dev on python 2.5.4 (linux2)
arguments: ['/home/jelmer/bzr/bzr.dev/bzr', 'svn-import',
'--incremental', 'https://svn.sourceforge.net/svnroot/libexif', 'exif']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
plugins:
  builddeb /home/jelmer/.bazaar/dev-plugins/builddeb [unknown]
  bzrtools /home/jelmer/.bazaar/dev-plugins/bzrtools [1.16]
  cia /home/jelmer/.bazaar/dev-plugins/cia [1.0dev]
  colocated /home/jelmer/.bazaar/dev-plugins/colocated
[0.4.16dev]
  cvsps_import
/usr/lib/python2.5/site-packages/bzrlib/plugins/cvsps_import [unknown]
  dbus /home/jelmer/.bazaar/dev-plugins/dbus.py [unknown]
  email
/usr/lib/python2.5/site-packages/bzrlib/plugins/email [unknown]
  etckeeper
/usr/lib/python2.5/site-packages/bzrlib/plugins/etckeeper [unknown]
  fastimport
/usr/lib/python2.5/site-packages/bzrlib/plugins/fastimport [0.8dev]
  git /home/jelmer/.bazaar/dev-plugins/git [0.3.3dev]
  gtk /home/jelmer/.bazaar/dev-plugins/gtk [0.96.0.dev.1]
  hg /home/jelmer/.bazaar/dev-plugins/hg [unknown]
  jelmer /home/jelmer/.bazaar/dev-plugins/jelmer [unknown]
  launchpad
/home/jelmer/bzr/bzr.dev/bzrlib/plugins/launchpad [1.17dev]
  loggerhead /home/jelmer/.bazaar/dev-plugins/loggerhead [1.11]
  loom /home/jelmer/.bazaar/dev-plugins/loom [1.4dev]
  netrc_credential_store
/home/jelmer/bzr/bzr.dev/bzrlib/plugins/netrc_credential_store [1.17dev]
  pqm /home/jelmer/.bazaar/dev-plugins/pqm [1.4dev]
  qbzr /home/jelmer/.bazaar/dev-plugins/qbzr [0.12dev]
  rebase /home/jelmer/.bazaar/dev-plugins/rebase [0.5.1dev]
  search /home/jelmer/.bazaar/dev-plugins/search [1.7dev]
  stats
/usr/lib/python2.5/site-packages/bzrlib/plugins/stats [unknown]
  svn /home/jelmer/.bazaar/dev-plugins/svn [0.6.2dev]
  upload /home/jelmer/.bazaar/dev-plugins/upload [1.0dev]
  webdav /home/jelmer/.bazaar/dev-plugins/webdav [1.12]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Some layers in bazaar seem to return parents as a list and others
return them as a tuple. Which of the two is correct here?

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 388470] [NEW] Inventories get added with different parents

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

...

> KnitCorrupt: Knit <bzrlib.groupcompress._GCGraphIndex object at
> 0x36de5d0> corrupt: inconsistent details in add_records: ('269 230 0
> 295', ((),)) ('269 230 0 295', ([],))
>

Well, the second time you are adding it with an empty parent *list*
while it has an empty parent *tuple*.

It looks like we use "record.parents" to populate that field.

I don't know where that value is getting set.

We could do a safety trap against it with something like:
=== modified file 'bzrlib/groupcompress.py'
- --- bzrlib/groupcompress.py 2009-06-11 20:34:56 +0000
+++ bzrlib/groupcompress.py 2009-06-17 14:17:23 +0000
@@ -1610,7 +1610,7 @@
                                 "in parentless index.")
                     refs = ()
                     changed = True
- - keys[key] = (value, refs)
+ keys[key] = (value, tuple(refs))
         # check for dups
         if not random_id:
             present_nodes = self._get_entries(keys)

However, I'd really like to understand

1) Why do you need to add the inventory twice
2) Why the 'parents' entry is a list sometimes and a tuple other times.
(It is always a tuple when reading from bzr indexes, so I'm assuming it
is set somewhere else.)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAko4+zkACgkQJdeBCYSNAAOCrwCgvXuB5t51G5eC3iKDhP+4Bezp
9a0AoI+Mosh1YBcsHdOxHfFzboBcrNZb
=RgIw
-----END PGP SIGNATURE-----

Revision history for this message
Robert Collins (lifeless) wrote :

tuples are the right representation. Perhaps its something from bzr-svn outputting an empty list?

affects: bzr → bzr-svn
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This was already fixed in bzr-svn 0.6.3.

Changed in bzr-svn:
status: Triaged → Fix Released
Jelmer Vernooij (jelmer)
Changed in bzr-svn:
assignee: nobody → Jelmer Vernooij (jelmer)
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.