[Pkg-bazaar-maint] Bug#630913: fails to commit if commiter name's contains non-ascii characters

Piotr Ożarowski piotr at debian.org
Sat Jun 18 17:33:25 UTC 2011


Package: bzr
Version: 2.4.0~beta4-2
Severity: normal
Tags: patch

$ bzr commit 
Committing to: bzr+ssh://piotr@bzr.debian.org/bzr/pkg-python/python-defaults-debian/              
modified dh_python2
bzr: ERROR: exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 52: ordinal not in range(128)

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 930, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 1130, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 691, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 713, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 3293, in run
    lossy=lossy)
  File "/usr/lib/python2.6/dist-packages/bzrlib/decorators.py", line 217, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/workingtree_4.py", line 209, in commit
    result = WorkingTree.commit(self, message, revprops, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/decorators.py", line 217, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/mutabletree.py", line 210, in commit
    *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commit.py", line 289, in commit
    lossy=lossy)
  File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 131, in run
    self.cleanups, self.func, self, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commit.py", line 436, in _commit
    message = message_callback(self)
  File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 3273, in get_message
    start_message=start_message)
  File "/usr/lib/python2.6/dist-packages/bzrlib/msgeditor.py", line 149, in edit_commit_message_encoded
    if not _run_editor(msgfilename):
  File "/usr/lib/python2.6/dist-packages/bzrlib/msgeditor.py", line 62, in _run_editor
    for candidate, candidate_source in _get_editor():
  File "/usr/lib/python2.6/dist-packages/bzrlib/msgeditor.py", line 44, in _get_editor
    e = config.GlobalStack().get('editor')
  File "/usr/lib/python2.6/dist-packages/bzrlib/config.py", line 2675, in get
    for section in sections:
  File "/usr/lib/python2.6/dist-packages/bzrlib/config.py", line 2417, in get_sections
    self.load()
  File "/usr/lib/python2.6/dist-packages/bzrlib/config.py", line 2369, in load
    self._load_from_string(content)
  File "/usr/lib/python2.6/dist-packages/bzrlib/config.py", line 2384, in _load_from_string
    co_input = StringIO(str_or_unicode.encode('utf-8'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 52: ordinal not in range(128)

bzr 2.4b4 on python 2.6.7 (Linux-2.6.39-2-amd64-x86_64-with-debian-wheezy-sid)
arguments: ['/usr/bin/bzr', 'commit']
plugins: bash_completion[2.4b4], builddeb[2.7.0dev], bzrtools[2.4.0],
    changelog_merge[2.4b4], dbus[0.1.0dev], etckeeper[unknown],
    explorer[1.1.3], gtk[0.101.0dev], launchpad[2.4b4],
    netrc_credential_store[2.4b4], news_merge[2.4b4], qbzr[0.20.1],
    weave_fmt[2.4b4]
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_GB.UTF-8'

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



and the patch:


--- a/bzrlib/config.py	2011-06-18 19:27:12.695076397 +0200
+++ b/bzrlib/config.py	2011-06-18 19:27:06.163076399 +0200
@@ -2381,7 +2381,9 @@
         """
         if self.is_loaded():
             raise AssertionError('Already loaded: %r' % (self._config_obj,))
-        co_input = StringIO(str_or_unicode.encode('utf-8'))
+        if isinstance(str_or_unicode, unicode):
+            str_or_unicode = str_or_unicode.encode('utf-8')
+        co_input = StringIO(str_or_unicode)
         try:
             # The config files are always stored utf8-encoded
             self._config_obj = ConfigObj(co_input, encoding='utf-8')





More information about the Pkg-bazaar-maint mailing list