[Pkg-bazaar-maint] Bug#703183: fails when commiter's name contains non-ascii characters

Jelmer Vernooij jelmer at samba.org
Sat Mar 16 23:39:27 UTC 2013


On Sat, Mar 16, 2013 at 03:14:01PM +0100, Piotr O??arowski wrote:
> happened while trying to push (via git's remote bzr helper) a commit that had "??" in
> commit author's name:
> 
> Traceback (most recent call last):ions
>   File "/home/piotr/.local/bin/git-remote-bzr", line 725, in <module>
>     sys.exit(main(sys.argv))
>   File "/home/piotr/.local/bin/git-remote-bzr", line 718, in main
>     do_export(parser)
>   File "/home/piotr/.local/bin/git-remote-bzr", line 601, in do_export
>     parse_commit(parser)
>   File "/home/piotr/.local/bin/git-remote-bzr", line 558, in parse_commit
>     builder = repo.get_commit_builder(parents, None, date, tz, committer, props, revid)
>   File "/usr/lib/python2.7/dist-packages/bzrlib/branch.py", line 734, in get_commit_builder
>     lossy)
>   File "/usr/lib/python2.7/dist-packages/bzrlib/vf_repository.py", line 1306, in get_commit_builder
>     lossy)
>   File "/usr/lib/python2.7/dist-packages/bzrlib/repofmt/pack_repo.py", line 110, in __init__
>     lossy=lossy)
>   File "/usr/lib/python2.7/dist-packages/bzrlib/vf_repository.py", line 117, in __init__
>     revision_id, lossy)
>   File "/usr/lib/python2.7/dist-packages/bzrlib/repository.py", line 104, in __init__
>     self._committer = committer.decode() # throw if non-ascii
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 7: ordinal not in range(128)
You either need to pass in either a unicode object or a ascii byte-string. 
The reason we accept bytestrings too - as Rob says - is that older
versions of Bazaar used ascii bytestrings and older callers might still
pass in bytestrings. Newer code really should pass in a unicode object.

The full code is:

        if committer is None:
            self._committer = self._config_stack.get('email')
        elif not isinstance(committer, unicode):
            self._committer = committer.decode() # throw if non-ascii
        else:
            self._committer = committer

This seems like a bug in git-bzr to me.

Cheers,

Jelmer



More information about the Pkg-bazaar-maint mailing list