Bug 509786

Summary: Non LANG=en_US.UTF-8 locales cause virt-install to bail out.
Product: Red Hat Enterprise Linux 5 Reporter: Wade Mealing <wmealing>
Component: python-virtinstAssignee: Cole Robinson <crobinso>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 5.5CC: xen-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-06 13:01:02 UTC Type: ---
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
I'm not sure if this is the best way,but at least it starts. none

Description Wade Mealing 2009-07-06 08:06:17 UTC
Description of problem:

Running virt-install from Chinese, Japanese or any other non english locale, ends up causing virt-install to fail prematurely.  It bails out due to a bad date format ( as far as I can tell) in the virt-manager, which is passed through to python logging framework.

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

F10, F11, Rawhide, RHEL5.

How reproducible:

Every time.

Steps to Reproduce:
1. Become one with uid 0.
2. export LANG=zh_CN.UTF8
3.# virt-install 
Traceback (most recent call last):
  File "/usr/lib64/python2.6/logging/handlers.py", line 74, in emit
    if self.shouldRollover(record):
  File "/usr/lib64/python2.6/logging/handlers.py", line 145, in shouldRollover
    msg = "%s\n" % self.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 637, in format
    return fmt.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 428, in format
    s = self._fmt % record.__dict__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 1: ordinal not in range(128)
ERROR    虚拟机需要一个名称。   

I assume the above message says like its english counterpart which is something along the lines of name not specified.
  
Actual results:

Application throws python traceback exception.

Expected results:

Application to not throw an error.

Additional info:

I will attach a patch which attempts to fix the problem, the only downside that I could notice is that the date stamps in the log file$HOME/.virtinstall/virt-install.log were no longer in the native locale.  Error messages remained the same.

Comment 1 Wade Mealing 2009-07-06 08:15:09 UTC
Created attachment 350583 [details]
I'm not sure if this is the best way,but at least it starts.

I found a way to work around this bug by modifying the loggers __init__.py although I'd imagine that it would require considerable QE in comparison to this work around.

Comment 2 Cole Robinson 2009-07-06 13:01:02 UTC
Thanks for the patch. There are actually other problems in this area that need a more complete fix, which are being tracked in bug 508784.

*** This bug has been marked as a duplicate of bug 508784 ***

Comment 3 Wade Mealing 2009-07-07 01:00:47 UTC
Yeah, I figured that was the case.  I have a fix for the logger too, although the solution was a little more complex.

Will transfer IT to this bug, Thanks Cole.