Fast-Import fails with IndexError in git_to_bzr

Bug #586014 reported by Grizzly
This bug report is a duplicate of:  Bug #590367: crash during fast-import. Edit Remove
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar Fast Import
Confirmed
Medium
Unassigned

Bug Description

(I think this -1 in the Index should only be issued if the array is populated...)

$ bzr fast-import x4-work.fi x4-work.bzr
Creating destination repository ...
Shared repository with trees (format: 2a)
Location:
  shared repository: x4-work.bzr
20:36:41 Collecting statistics ...
20:36:43 Starting import of 30 commits ...
ABORT: exception occurred processing commit :1
bzr: ERROR: exceptions.IndexError: list index out of range

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 853, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 1055, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 661, in run_argv_aliases
    return self.run_direct(**all_cmd_args)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 665, in run_direct
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 122, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 156, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/__init__.py", line 384, in run
    params, verbose, user_map=user_map)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/__init__.py", line 111, in _run
    return proc.process(p.iter_commands)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/processor.py", line 95, in process
    self._process(command_iter)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/processors/generic_processor.py", line 280, in _process
    processor.ImportProcessor._process(self, command_iter)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/processor.py", line 117, in _process
    handler(self, cmd)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/processors/generic_processor.py", line 490, in commit_handler
    handler.process()
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/processor.py", line 200, in process
    self.pre_process_files()
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/bzr_commit_handler.py", line 578, in pre_process_files
    super(InventoryDeltaCommitHandler, self).pre_process_files()
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/bzr_commit_handler.py", line 91, in pre_process_files
    self.revision = self.build_revision()
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/bzr_commit_handler.py", line 223, in build_revision
    self.branch_ref)
  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/branch_mapper.py", line 39, in git_to_bzr
    name_no_ext = self._git_to_bzr_name(parts[-1])
IndexError: list index out of range

bzr 2.1.1 on python 2.6.5 (Linux-2.6.32-22-generic-x86_64-with-LinuxMint-9-isadora)
arguments: ['/usr/bin/bzr', 'fast-import', 'x4-work.fi', 'x4-work.bzr']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'de_DE.utf8'
plugins:
  bzrtools /usr/lib/python2.6/dist-packages/bzrlib/plugins/bzrtools [2.1.0]
  dbus /usr/lib/python2.6/dist-packages/bzrlib/plugins/dbus [0.1.0dev]
  explorer /usr/lib/python2.6/dist-packages/bzrlib/plugins/explorer [1.0.1]
  fastimport /usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport [0.9.0dev]
  git /usr/lib/python2.6/dist-packages/bzrlib/plugins/git [0.4.3]
  gtk /usr/lib/python2.6/dist-packages/bzrlib/plugins/gtk [0.98.0.final.1]
  hg /usr/lib/python2.6/dist-packages/bzrlib/plugins/hg [0.2.0dev]
  launchpad /usr/lib/python2.6/dist-packages/bzrlib/plugins/launchpad [2.1.1]
  netrc_credential_store /usr/lib/python2.6/dist-packages/bzrlib/plugins/netrc_credential_store [2.1.1]
  news_merge /usr/lib/python2.6/dist-packages/bzrlib/plugins/news_merge [2.1.1]
  qbzr /usr/lib/python2.6/dist-packages/bzrlib/plugins/qbzr [0.18.6]
  rebase /usr/lib/python2.6/dist-packages/bzrlib/plugins/rebase [0.5.5]
  svn /usr/lib/python2.6/dist-packages/bzrlib/plugins/svn [1.0.2]

*** 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/bzr/+filebug
    including this traceback and a description of the problem.

Revision history for this message
Martin Pool (mbp) wrote :

Hi,

Can you provide a small fastimport file that reproduces this problem?

summary: - Fast-Import fails (with mercurial AND git)
+ Fast-Import fails with IndexError in git_to_bzr
affects: bzr → bzr-fastimport
Changed in bzr-fastimport:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Grizzly (sven-witterstein) wrote :

Actually not, as I am only contributing to a (commercial) project and was playing around with bazaar.
BUT I think the error is so obvious: whenever in python you access an array / list / tuple it will throw exceptions when you violate the border constraints.

  File "/usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/branch_mapper.py", line 39, in git_to_bzr
    name_no_ext = self._git_to_bzr_name(parts[-1])
IndexError: list index out of range

This will always fail if the array is empty!!

Solution would be something like:
if len(self._git_to_bzr_name) > 1:
  ....
else :
  name_no_ext = <unmodified>

There's probably something in the os.path module like splitext or something that is more suitable to use...

Revision history for this message
a (tuomasjjrasanen) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This particular bug has already been reported and is a duplicate of bug 590367, so it is being marked as such. Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug. Additionally, any further discussion regarding the bug should occur in the other report. Feel free to continue to report any other bugs you may find.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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