Bug 979399

Summary: the command "bzr version" fails with traceback.
Product: [Fedora] Fedora Reporter: Barry Fishman <barry>
Component: bzrAssignee: Toshio Ernie Kuratomi <a.badger>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: a.badger, henrik, ooprala, shahms, vvitek
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: bzr-2.5.1-13.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-18 05:48:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
results from 'bzr version >try.log 2>&1' none

Description Barry Fishman 2013-06-28 12:36:29 UTC
Created attachment 766556 [details]
results from 'bzr version >try.log 2>&1'

Description of problem:

On entering the command "bzr version", the command fails with a traceback
message.

My LANG setting is: en_US.UTF-8

Version-Release number of selected component (if applicable):

bzr-2.5.1-12.fc19.x86_64

How reproducible:

Always.

Steps to Reproduce:
1. enter the command "bzr version"

Actual results:

See attachement

Expected results:

Version information is listed, with no errors

Additional info:

Comment 1 Toshio Ernie Kuratomi 2013-06-28 15:54:27 UTC
Filed upstream.  https://bugs.launchpad.net/bzr/+bug/1195783

I'll see if the change I mentioned in that bug will work and pass the test suite.

Comment 2 Toshio Ernie Kuratomi 2013-06-29 01:44:41 UTC
Ugh.  The workaround makes a ton more selftests fail.  I think it may be because of the way the selftests are setup (they're using a StringIO rather than a StreamWriter) but I'm not certain.  This may take a while to fix.

Comment 3 Toshio Ernie Kuratomi 2013-07-02 17:37:45 UTC
Here's a hack we could try:

try:
    self.wrapped_stream.write(to_write)
except UnicodeError:
    to_write = unicode(to_write, encoding=self.encoding or 'ascii', errors='replace')
    self.wrapped_stream.write(to_write)

This first tries the current method of simply passing the string to wrapped_stream.write() [which seems like it is wrong] and if that raises an exception then trying my code instead.

If this makes the selftests pass, I'd be willing to apply this to our package.  It's definitely a hack, though, as it's just papering over a broken unicode model somewhere between upstream's code and upstream's test cases.

Comment 4 Toshio Ernie Kuratomi 2013-07-04 15:36:35 UTC
This didn't work.  I think that sometimes the following is happening:

* locale is C (therefore only ascii can be printed to the terminal).
* The text/ui.py function gets a unicode string with non-ascii characters
* This gets passed to self.wrapped_stream.write which fails to write it because there's no way to translate non-ascii to ascii using a StreamWriter.
* UnicodeError gets thrown.
* We catch it - but then we cannot transform unicode into unicode so we get a traceback.

Here's a new hack (now with 50% more "Eeewww" to workaround this type of input):

try:
    self.wrapped_stream.write(to_write)
except UnicodeError:
    if isinstance(to_write, unicode):
        to_write = to_write.decode(self.encoding or 'ascii', errors='replace')
    to_write = unicode(to_write, encoding=self.encoding or 'ascii', errors='replace')
    self.wrapped_stream_write(to_write)

Comment 5 Toshio Ernie Kuratomi 2013-07-04 16:57:41 UTC
bzr selftests summary before my change:

FAILED (failures=10, errors=29, known_failure_count=62)
1093 tests skipped

After my change:

FAILED (failures=7, errors=25, known_failure_count=62)
1093 tests skipped

(On a Fedora 17 system with /etc/fedora-release modified to include non-ascii characters)

I'll go ahead and apply this to F19 (where Shröedinger's Cat is causing the issue to occur and F20.

Comment 6 Fedora Update System 2013-07-05 16:01:05 UTC
bzr-2.5.1-13.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/bzr-2.5.1-13.fc19

Comment 7 Fedora Update System 2013-07-07 01:39:58 UTC
Package bzr-2.5.1-13.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing bzr-2.5.1-13.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-12537/bzr-2.5.1-13.fc19
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2013-07-18 05:48:37 UTC
bzr-2.5.1-13.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.