bzr crashed with IndexError in git_to_bzr()

Bug #662245 reported by Duncan McGreggor
This bug report is a duplicate of:  Bug #590367: crash during fast-import. Edit Remove
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar Fast Import
New
Undecided
Unassigned
bzr (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: bzr

I was using fast-import to isolate a subdirectory of a large branch. I used the following:

 $ bzr fast-export ~/lab/largeProject project.fe
 $ bzr fast-import-filter -i projectSubdir project.fe > subdir.fi
 $ mkdir filtered-project
 $ cd filtered-project
 $ bzr fast-import ../subdir.fi

This resulted in a "IndexError: list index out of range" exception.

ProblemType: Crash
DistroRelease: Ubuntu 10.10
Package: bzr 2.2.1-0ubuntu1
ProcVersionSignature: Ubuntu 2.6.35-22.34-generic 2.6.35.4
Uname: Linux 2.6.35-22-generic i686
Architecture: i386
BzrDebugFlags: set()
BzrVersion: 2.2.1
CommandLine: ['/usr/bin/bzr', 'fast-import', '../new.fi']
CrashDb: bzr
Date: Sun Oct 17 09:35:42 2010
ExecutablePath: /usr/bin/bzr
FileSystemEncoding: ANSI_X3.4-1968
InstallationMedia: Ubuntu-Netbook 10.10 "Maverick Meerkat" - Alpha i386 (20100803.1)
InterpreterPath: /usr/bin/python2.6
Locale: en_US.UTF-8
Platform: Linux-2.6.35-22-generic-i686-with-Ubuntu-10.10-maverick
ProcCmdline: /usr/bin/python /usr/bin/bzr fast-import ../new.fi
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, user)
 LANG=en_US.UTF-8
 LANGUAGE=en_US.UTF-8
 LC_CTYPE=C
PythonVersion: 2.6.6
SourcePackage: bzr
Title: bzr crashed with IndexError in git_to_bzr()
UserEncoding: ANSI_X3.4-1968
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare

Revision history for this message
Duncan McGreggor (oubiwann) wrote :
Revision history for this message
Apport retracing service (apport) wrote : This bug is a duplicate

Thank you for taking the time to report this crash and helping to make Ubuntu better. This particular crash has already been reported and is a duplicate of bug #660540, so 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. Please continue to report any other bugs you may find.

tags: removed: need-duplicate-check
visibility: private → public
Revision history for this message
Duncan McGreggor (oubiwann) wrote :

Hrm, interesting. I added a pdb set_trace call to check this out. Looks like a string is being iterated over in a rather strange way. I can't imagine that 'refs/heads/master' is intended to be iterated over by-character. Rather, by a split on '/'.

Here's the interactive pdb session:

(Pdb) list
 26 the Bazaar branch names as values.
 27 """
 28 bazaar_names = {}
 29 for ref_name in sorted(ref_names):
 30 import pdb;pdb.set_trace()
 31 -> parts = ref_name.split('/')
 32 if parts[0] == 'refs':
 33 parts.pop(0)
 34 category = parts.pop(0)
 35 if category == 'heads':
 36 bazaar_name = self._git_to_bzr_name(parts[-1])
(Pdb) ref_name
'/'
(Pdb) ref_names
'refs/heads/master'
(Pdb) sorted(ref_names)
['/', '/', 'a', 'a', 'd', 'e', 'e', 'e', 'f', 'h', 'm', 'r', 'r', 's', 's', 's', 't']
(Pdb)

I added the following just before the 'for' loop:

        if not isinstance(ref_names, list):
            ref_names = [ref_names]

This resulted in another exception, however:

  File "/usr/lib/python2.6/dist-packages/bzrlib/revision.py", line 93, in _check_properties
    (value, name))
ValueError: invalid property value {'refs/heads/master': 'trunk'} for 'branch-nick'

After some hacking around, it seems that even though git_to_bzr() is returning a dict, when a string is expected. In particular, check out the following from a pdb session:

(Pdb) down
> /usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/bzr_commit_handler.py(227)build_revision()
-> self.branch_ref)
(Pdb) list
222
223 def build_revision(self):
224 rev_props = self._legal_revision_properties(self.command.properties)
225 if 'branch-nick' not in rev_props:
226 rev_props['branch-nick'] = self.cache_mgr.branch_mapper.git_to_bzr(
227 -> self.branch_ref)
228 self._save_author_info(rev_props)
229 committer = self.command.committer
230 who = self._format_name_email(committer[0], committer[1])
231 message = self.command.message
232 if not _serializer_handles_escaping:

rev_props['branch-nick'] should be getting a string assigned to it, but instead, it's getting a dict.

I hacked around this (badly) just to get things working by returning the following from git_to_bzr:

return bazaar_names.values()[0]

Hope this helps...

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.