bzr fast-export-from-p4 fails with UnboundLocalError

Bug #661553 reported by Chris Osborn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar Fast Import
Invalid
Low
Jelmer Vernooij

Bug Description

Fast export from p4 ran silently for several seconds before failing. It produced a sizable but invalid .fi file (produced an unexpected EOF error when fed back into bzr fast-import). The error is entirely repeatable, and appears to occur right at the end of the export run. Exporting large amounts of data takes longer and produces a larger invalid file than when exporting smaller amounts.

This is on OS X 10.6.

Here's the output:

mbp:~ csosborn$ bzr fast-export-from-p4 //depot/web/main main.fi
bzr: ERROR: exceptions.UnboundLocalError: local variable 'retcode' referenced before assignment

Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 911, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 1111, in run_bzr
    ret = run(*run_argv)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 689, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 704, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/fastimport/__init__.py", line 903, in run
    fast_export_from(source, destination, 'p4', verbose, custom)
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/fastimport/exporters/__init__.py", line 327, in fast_export_from
    custom=custom)
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/fastimport/exporters/__init__.py", line 283, in generate
    self.report_results(retcode, destination)
UnboundLocalError: local variable 'retcode' referenced before assignment

bzr 2.2.0 on python 2.6.1 (Darwin-10.4.0-i386-64bit)
arguments: ['/usr/local/bin/bzr', 'fast-export-from-p4', '//depot/web/main', 'main.fi']
encoding: 'UTF-8', fsenc: 'utf-8', lang: 'en_US.UTF-8'
plugins:
  bash_completion /Library/Python/2.6/site-packages/bzrlib/plugins/bash_completion [2.2.0]
  bzrp4 /Library/Python/2.6/site-packages/bzrlib/plugins/bzrp4 [unknown]
  bzrtools /Library/Python/2.6/site-packages/bzrlib/plugins/bzrtools [2.2.0]
  colo /Library/Python/2.6/site-packages/bzrlib/plugins/colo [0.1.0]
  email /Library/Python/2.6/site-packages/bzrlib/plugins/email [unknown]
  explorer /Library/Python/2.6/site-packages/bzrlib/plugins/explorer [1.1.0dev2]
  extmerge /Library/Python/2.6/site-packages/bzrlib/plugins/extmerge [unknown]
  fastimport /Library/Python/2.6/site-packages/bzrlib/plugins/fastimport [0.9.0dev]
  keychain /Library/Python/2.6/site-packages/bzrlib/plugins/keychain [0.1.0]
  launchpad /Library/Python/2.6/site-packages/bzrlib/plugins/launchpad [2.2.0]
  loom /Library/Python/2.6/site-packages/bzrlib/plugins/loom [2.2.1dev]
  netrc_credential_store /Library/Python/2.6/site-packages/bzrlib/plugins/netrc_credential_store [2.2.0]
  news_merge /Library/Python/2.6/site-packages/bzrlib/plugins/news_merge [2.2.0]
  pipeline /Library/Python/2.6/site-packages/bzrlib/plugins/pipeline [unknown]
  qbzr /Library/Python/2.6/site-packages/bzrlib/plugins/qbzr [0.20.0dev1]
  rewrite /Library/Python/2.6/site-packages/bzrlib/plugins/rewrite [0.6.0]
  svn /Library/Python/2.6/site-packages/bzrlib/plugins/svn [1.0.4dev]
  upload /Library/Python/2.6/site-packages/bzrlib/plugins/upload [1.0.0dev]
  xmloutput /Library/Python/2.6/site-packages/bzrlib/plugins/xmloutput [0.8.6]

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

Related branches

affects: bzr → bzr-fastimport
Revision history for this message
Chris Osborn (chris-osborn) wrote :
Download full text (4.9 KiB)

I looked a little closer and found that the invalid reference to "retcode" occurs in the finally portion of a try block, and that retcode is not set because an exception is thrown earlier. Initializing retcode and trying again reveals the actual error. Although the output claims that the export completed successfully, the resulting file is incomplete.

mbp:~ csosborn$ bzr fast-export-from-p4 //depot/web/main main.fi
Export to main.fi completed successfully.
bzr: ERROR: exceptions.IndexError: list index out of range

Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 911, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 1111, in run_bzr
    ret = run(*run_argv)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 689, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 704, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/fastimport/__init__.py", line 903, in run
    fast_export_from(source, destination, 'p4', verbose, custom)
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/fastimport/exporters/__init__.py", line 328, in fast_export_from
    custom=custom)
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/fastimport/exporters/__init__.py", line 281, in generate
    retcode = p4_fast_export.main([source])
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/bzrp4/p4_fast_export.py", line 10, in main
    return git_p4.main(['export'] + args)
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/bzrp4/git_p4.py", line 1899, in main
    if not cmd.run(args):
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/bzrp4/git_p4.py", line 1740, in run
    if not P4Sync.run(self, depotPaths):
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/bzrp4/git_p4.py", line 1534, in run
    self.importHeadRevision(revision)
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/bzrp4/git_p4.py", line 1334, in importHeadRevision
    self.commit(details, self.extractFilesFromCommit(details), self.branch, self.depotPaths)
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/bzrp4/git_p4.py", line 937, in commit
    data = file.get_data(p4)
  File "/Library/Python/2.6/site-packages/bzrlib/plugins/bzrp4/git_p4.py", line 1802, in get_data
    stat = filedata[0]
IndexError: list index out of range

bzr 2.2.0 on python 2.6.1 (Darwin-10.4.0-i386-64bit)
arguments: ['/usr/local/bin/bzr', 'fast-export-from-p4', '//depot/web/main/sks/packages/sitelier-sks', 'sks.fi']
encoding: 'UTF-8', fsenc: 'utf-8', lang: 'en_US.UTF-8'
plugins:
  bash_completion /Library/Python/2.6/site-packages/bzrlib/plugins/bash_completion [2.2.0]
  bzrp4 /Library/Python/2.6/site-packages/bzrlib/pl...

Read more...

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

The error message should at least be a bit saner in trunk.

Changed in bzr-fastimport:
status: New → Triaged
importance: Undecided → Low
Jelmer Vernooij (jelmer)
Changed in bzr-fastimport:
assignee: nobody → Jelmer Vernooij (jelmer)
status: Triaged → In Progress
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

I'm closing this as invalid as bzr-fastimport is no longer shipping fastexporters for other version control systems.

Changed in bzr-fastimport:
status: In Progress → Invalid
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.