UnicodeDecodeError loading config file containing invalid UTF-8

Bug #688677 reported by James Ferguson on 2010-12-10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Vincent Ladeuil
bzr (Ubuntu)
Jelmer Vernooij

Bug Description

Binary package hint: bzr

10.10 amd64
bzr 2.2.1-0ubuntu1

I see similar bugs, but I'm not sure if this is exactly the same. This is on a branch which has only been lightly touched, and I haven't knowingly created any files, let alone ones with unusual filenames. I ran bzr commands, such as status, yesterday with no problems, but today, running bzr status:


bzr: ERROR: exceptions.UnicodeDecodeError: 'utf8' codec can't decode byte 0xa6 in position 4097: invalid start byte

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 912, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 1112, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 690, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 705, 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/commands.py", line 1127, in ignore_pipe
    result = func(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 326, in run
    tree, relfile_list = tree_files(file_list)
  File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 82, in tree_files
  File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 175, in internal_tree_files
    tree = WorkingTree.open_containing(default_branch)[0]
  File "/usr/lib/python2.6/dist-packages/bzrlib/workingtree.py", line 353, in open_containing
    return control.open_workingtree(), relpath
  File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py", line 1888, in open_workingtree
    return format.open(self, _found=True)
  File "/usr/lib/python2.6/dist-packages/bzrlib/workingtree.py", line 3064, in open
    wt = self._open(a_bzrdir, self._open_control_files(a_bzrdir))
  File "/usr/lib/python2.6/dist-packages/bzrlib/workingtree_4.py", line 1499, in _open
  File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py", line 1871, in open_branch
    _found=True, ignore_fallbacks=ignore_fallbacks)
  File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 2070, in open
  File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 2787, in __init__
    super(BzrBranch8, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 2410, in __init__
  File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 96, in __init__
  File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 2771, in _open_hook
    url = self.get_stacked_on_url()
  File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 2998, in get_stacked_on_url
    stacked_url = self._get_config_location('stacked_on_location')
  File "/usr/lib/python2.6/dist-packages/bzrlib/branch.py", line 1139, in _get_config_location
    location = config.get_user_option(name)
  File "/usr/lib/python2.6/dist-packages/bzrlib/config.py", line 188, in get_user_option
    return self._get_user_option(option_name)
  File "/usr/lib/python2.6/dist-packages/bzrlib/config.py", line 746, in _get_user_option
    value = source()._get_user_option(option_name)
  File "/usr/lib/python2.6/dist-packages/bzrlib/config.py", line 416, in _get_user_option
    value = self._get_parser().get_value(section, option_name)
  File "/usr/lib/python2.6/dist-packages/bzrlib/config.py", line 941, in _get_parser
    return self._config._get_configobj()
  File "/usr/lib/python2.6/dist-packages/bzrlib/config.py", line 1455, in _get_configobj
    return ConfigObj(f, encoding='utf-8')
  File "/usr/lib/python2.6/dist-packages/bzrlib/config.py", line 144, in ConfigObj
    return _ConfigObj(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/util/configobj/configobj.py", line 1223, in __init__
    self._load(infile, configspec)
  File "/usr/lib/python2.6/dist-packages/bzrlib/util/configobj/configobj.py", line 1276, in _load
    infile = self._handle_bom(infile)
  File "/usr/lib/python2.6/dist-packages/bzrlib/util/configobj/configobj.py", line 1412, in _handle_bom
    return self._decode(infile, self.encoding)
  File "/usr/lib/python2.6/dist-packages/bzrlib/util/configobj/configobj.py", line 1472, in _decode
    return infile.decode(encoding).splitlines(True)
  File "/usr/lib/python2.6/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa6 in position 4097: invalid start byte

You can report this problem to Bazaar's developers by running
    apport-bug /var/crash/bzr.1000.2010-12-10T18:25.crash
if a bug-reporting window does not automatically appear.

ProblemType: Crash
DistroRelease: Ubuntu 10.10
Package: bzr 2.2.1-0ubuntu1
ProcVersionSignature: Ubuntu 2.6.35-24.42-generic
Uname: Linux 2.6.35-24-generic x86_64
Architecture: amd64
BzrDebugFlags: set()
BzrVersion: 2.2.1
CommandLine: ['/usr/bin/bzr', 'status']
CrashDb: bzr
Date: Fri Dec 10 13:25:40 2010
EcryptfsInUse: Yes
ExecutablePath: /usr/bin/bzr
FileSystemEncoding: UTF-8
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release Candidate amd64 (20100928)
InterpreterPath: /usr/bin/python2.6
Locale: en_US.utf8
Platform: Linux-2.6.35-24-generic-x86_64-with-Ubuntu-10.10-maverick
ProcCmdline: /usr/bin/python /usr/bin/bzr status
 PATH=(custom, user)
PythonVersion: 2.6.6
SourcePackage: bzr
Title: bzr crashed with UnicodeDecodeError in decode()
UserEncoding: UTF-8
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare sbuild

Related branches

James Ferguson (jamesf) wrote :
tags: removed: need-duplicate-check
Martin Pool (mbp) on 2011-04-12
visibility: private → public
Martin Packman (gz) wrote :

This looks like a worse version of bug 502060 caused by having non UTF-8 bytes in a config file. In these circumstances Bazaar should be fixed to give a clear error including the filename.

The solution if you're running into this problem would be to delete or manually correct the problem file.

Changed in bzr:
importance: Undecided → Low
status: New → Confirmed
Changed in bzr (Ubuntu):
status: New → Confirmed
summary: - bzr crashed with UnicodeDecodeError in decode()
+ UnicodeDecodeError loading config file containing invalid UTF-8
Jelmer Vernooij (jelmer) on 2011-04-28
Changed in bzr (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Low
Vincent Ladeuil (vila) on 2011-04-29
tags: added: config
removed: amd64 apport-crash maverick ubuntu-une
Vincent Ladeuil (vila) on 2011-06-20
Changed in bzr:
assignee: nobody → Vincent Ladeuil (vila)
status: Confirmed → In Progress
Vincent Ladeuil (vila) on 2011-06-20
Changed in bzr:
milestone: none → 2.4b5
status: In Progress → Fix Released
Jelmer Vernooij (jelmer) on 2011-08-14
Changed in bzr (Ubuntu):
status: Triaged → In Progress
assignee: nobody → Jelmer Vernooij (jelmer)
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bzr - 2.4.0-0ubuntu1

bzr (2.4.0-0ubuntu1) oneiric; urgency=low

  * New upstream release.
   + Fixes version number in deprecation warnings. LP: #794960
   + Fixes some spelling mistakes in manual page. LP: #814311
   + Prevents taking file system locks in read only transactions.
     LP: #786980
   + Fix support for configuration files containing UTF-8 data.
     LP: #688677
 -- Jelmer Vernooij <email address hidden> Sun, 14 Aug 2011 02:35:33 +0200

Changed in bzr (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers