bzr commit throws exceptions.UnicodeEncodeError when --fixes contains cyrillic

Bug #563692 reported by Stas Kalashnikov on 2010-04-15
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Bazaar
High
Unassigned
Breezy
High
Jelmer Vernooij

Bug Description

>bzr ci -m "Commit msg." file.txt --fixes=Message
bzr: ERROR: Invalid bug Message. Must be in the form of 'tracker:id'. See "bzr help bugs" for more information on this feature.
Commit refused.

bzr commit throws an exception if "--fixes" contains text in Russian:
>bzr ci -m "Messege" file.txt --fixes=Сообщение
bzr: ERROR: exceptions.UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)

Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 853, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1055, in run_bzr
  File "bzrlib\commands.pyo", line 631, in run_argv_aliases
  File "bzrlib\commands.pyo", line 754, in parse_args
  File "optparse.pyo", line 1387, in parse_args
  File "optparse.pyo", line 1427, in _process_args
  File "optparse.pyo", line 1502, in _process_long_opt
  File "optparse.pyo", line 774, in process
  File "optparse.pyo", line 794, in take_action
  File "bzrlib\option.pyo", line 287, in _optparse_callback
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)

bzr 2.1.1 on python 2.5.4 (Windows-XP-5.1.2600-SP3)
arguments: ['bzr', 'commit', '-m', 'Messege', 'file.txt', '--fixes=\xd1\xee\xee\xe1\xf9\xe5\xed\xe8\xe5']
encoding: 'cp1251', fsenc: 'mbcs', lang: 'en'
plugins:
  bzrtools C:\Program Files\Bazaar\plugins\bzrtools [2.1.0]
  explorer C:\Program Files\Bazaar\plugins\explorer [1.0.1]
  launchpad C:\Program Files\Bazaar\plugins\launchpad [2.1.1]
  netrc_credential_store C:\Program Files\Bazaar\plugins\netrc_credential_store [2.1.1]
  news_merge C:\Program Files\Bazaar\plugins\news_merge [2.1.1]
  qbzr C:\Program Files\Bazaar\plugins\qbzr [0.18.4]
  rebase C:\Program Files\Bazaar\plugins\rebase [0.5.5]
  svn C:\Program Files\Bazaar\plugins\svn [1.0.2]
  upload C:\Program Files\Bazaar\plugins\upload [1.0.0dev]
  xmloutput C:\Program Files\Bazaar\plugins\xmloutput [0.8.7.dev]

Related branches

Alexander Belchenko (bialix) wrote :

Even though using non-ascii characters is incorrect but bzr should not traceback.

Changed in bzr:
status: New → Confirmed
importance: Undecided → High
Parth Malwankar (parthm) on 2010-04-15
tags: added: unicode
Martin Packman (gz) wrote :

Problem appears to be with any optparse.Option that specifies type=str, which will naturally raise on non-ascii values. Either a type function that reraises a useful error should be substituted, or a higher layer should catch the UnicodeError and handle it there.

DNS (dns) wrote :

I get a similar error when i try to compile a source package from 'lp:parallel' with the launchpad auto-buildsystem:

bzr: ERROR: exceptions.UnicodeEncodeError: 'ascii' codec can't encode characters in position 165-166: ordinal not in range(128)

https://launchpadlibrarian.net/79455753/buildlog.txt.gz (just scroll to the bottom)

Rory Yorke (ryorke) wrote :

This is related to #140563, and on my Ubuntu 10.04 / bzr 2.4.2 system I get

  rory@rory-laptop:~/tmp/bzr/foo$ bzr ci -m "Messege" file.txt --fixes=Сообщение
  bzr: ERROR: Only ASCII permitted in option names

The error message is not great, since the non-ASCII part is not really in an option
name. Changing it to "Only ASCII permitted on the command-line" would be false, since
non-ASCII *is* permitted, e.g., in the commit message (--message argument).
How about "Only ASCII permitted in option names and some option arguments" ?

Jelmer Vernooij (jelmer) wrote :

Hi DNS,

The bug you're hitting is different from this bug (though the error message looks similar). Please file a separate bug report.

Jelmer Vernooij (jelmer) on 2017-11-08
tags: added: check-for-breezy
Jelmer Vernooij (jelmer) on 2017-11-11
tags: removed: check-for-breezy
Changed in brz:
status: New → Triaged
importance: Undecided → High
Jelmer Vernooij (jelmer) wrote :

blodeuwedd:~/src/breezy/unicode-option% ./brz ci --fixes Сообщение
brz: ERROR: No tracker specified for bug Сообщение. Use the form 'tracker:id' or specify a default bug tracker using the `bugtracker` option.
See "brz help bugs" for more information on this feature. Commit refused.

Changed in brz:
milestone: none → 3.0.0
assignee: nobody → Jelmer Vernooij (jelmer)
Jelmer Vernooij (jelmer) on 2017-11-12
Changed in brz:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers