Crash when comitting with non-English description

Bug #209046 reported by Jonán C. Martín
4
Affects Status Importance Assigned to Milestone
Bazaar
Triaged
Low
Unassigned

Bug Description

I was comitting changes to a project branch and told bazaar to load the revision's description from a file with the '-F' argument. The file contains Unicode text with some non-English characters and bazaar crashed, giving the following traceback:

(bazaar on Mac OS X 10.4 Tiger, installed using MacPorts)

bzr: ERROR: exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 14: ordinal not in range(128)

Traceback (most recent call last):
  File "/opt/local/lib/python2.5/site-packages/bzrlib/commands.py", line 802, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/opt/local/lib/python2.5/site-packages/bzrlib/commands.py", line 758, in run_bzr
    ret = run(*run_argv)
  File "/opt/local/lib/python2.5/site-packages/bzrlib/commands.py", line 492, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/opt/local/lib/python2.5/site-packages/bzrlib/builtins.py", line 2334, in run
    author=author)
  File "/opt/local/lib/python2.5/site-packages/bzrlib/decorators.py", line 165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/opt/local/lib/python2.5/site-packages/bzrlib/workingtree_4.py", line 245, in commit
    result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
  File "/opt/local/lib/python2.5/site-packages/bzrlib/decorators.py", line 165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/opt/local/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 187, in commit
    revprops=revprops, *args, **kwargs)
  File "/opt/local/lib/python2.5/site-packages/bzrlib/commit.py", line 367, in commit
    message = message_callback(self)
  File "/opt/local/lib/python2.5/site-packages/bzrlib/builtins.py", line 2324, in get_message
    bzrlib.user_encoding).read()
  File "/opt/local/lib/python2.5/codecs.py", line 618, in read
    return self.reader.read(size)
  File "/opt/local/lib/python2.5/codecs.py", line 424, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 14: ordinal not in range(128)

bzr 1.0.0 on python 2.5.1.final.0 (darwin)
arguments: ['/opt/local/bin/bzr', 'commit', '-F', 'cambios.txt']
encoding: 'US-ASCII', fsenc: 'utf-8', lang: None
plugins:
  bzrtools /opt/local/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.0.0]
  launchpad /opt/local/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
  multiparent /opt/local/lib/python2.5/site-packages/bzrlib/plugins/multiparent.pyc [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Revision history for this message
Matt Nordhoff (mnordhoff) wrote :

Try:

LANG=en_US.UTF-8 bzr commit -F cambios.txt

(or whatever the right environment variable would be on OS X)

This isn't really a bzr bug. You gave it a UTF-8 commit message, but the system's charset is ASCII. It should give a more friendly error message, of course. Maybe that's been improved in more recent versions; 1.0 is a little old.

Revision history for this message
Jonán C. Martín (jonanc-martin+launchpad) wrote :

Ok, thanks. That worked perfectly.

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

We should probably be giving a better error message in this case?

Changed in bzr:
importance: Undecided → Low
status: New → Triaged
Martin Pool (mbp)
tags: added: commit encoding unicode
removed: characters crash description non-english revision
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.