Bug 484259 - Setroubleshoot daemon fails with localized messages
Setroubleshoot daemon fails with localized messages
Product: Fedora
Classification: Fedora
Component: setroubleshoot (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Daniel Walsh
Fedora Extras Quality Assurance
: Triaged
Depends On:
Blocks: 517000
  Show dependency treegraph
Reported: 2009-02-05 12:53 EST by Göran Uddeborg
Modified: 2010-02-01 10:52 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-02-01 10:52:51 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Göran Uddeborg 2009-02-05 12:53:41 EST
Description of problem:
I've configured setroubleshootd to send mail to an administrative user.  On a system with sv_SE.utf8 as system locale, no mails are sent.  Instead, a python backtrace winds up in /var/log/messages.

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

How reproducible:
Every time.

Steps to Reproduce:
1. Put "LANG=sv_SE.utf8" in /etc/sysconfig/i18n
2. Wait for an AVC message
Actual results:
I get a traceback in /var/log/messages.  (I've added a few newlines for readability.  Maybe bugzilla will add a few more.)

Feb  5 18:30:02 mimmi setroubleshoot: [avc.ERROR] Plugin Exception catchall_file
  Traceback (most recent call last):
   File "/usr/lib/python2.5/site-packages/setroubleshoot/analyze.py", line 159, in analyze_avc     report_receiver.report_problem(report)
   File "/usr/lib/python2.5/site-packages/setroubleshoot/server.py", line 150, in report_problem     email_alert(siginfo, to_addrs)
   File "/usr/lib/python2.5/site-packages/setroubleshoot/email_alert.py", line 64, in email_alert     text = siginfo.format_text()
   File "/usr/lib/python2.5/site-packages/setroubleshoot/signature.py", line 465, in format_text     text += html_to_text('<h1>'+_("Detailed Description")+':</h1>'+description) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 21: ordinal not in range(128)

Expected results:
A mail explaining the problem.

Additional info:
With some experimentation, I've figured out that it is the "description" variable that triggers the problem.  If I remove that, the problem doesn't happen on that line.  (A similar traceback happens a few lines further on for the "fix".

But character encodings in Python is a mystery to me, and I don't know how to avoid the problem.  (Short of omitting the description and fix.  But that has unfortunate side effects on the message sent, obviously.)
Comment 1 John Dennis 2009-02-06 14:13:27 EST
Göran, since you seem capable of editing the python code it would help us if you could get some diagnostic information for us. I need to know the type of the description variable. Could you please add this line in /usr/lib/python*/site-packages/setroubleshoot/signature.py in the format_text() function after the description variable is initialized.

log_sig.error("type(description) = %s", type(description))

This will cause the message to be written to syslog and /var/log/setroubleshoot/setroubleshootd.log

then recreate the problem and let us know what the type is. My guess is it will be <type 'unicode'> based on the traceback, but it should be <type 'str'>.


Also, by any chance did you edit /etc/setroubleshoot/setroubleshoot.cfg and modify the encoding?

Which version of Python are you running?
Comment 2 Göran Uddeborg 2009-02-06 17:27:34 EST
:-)  I'm not afraid to hack around a little, even if I'm still learning the language when it comes to Python.

But the type of "description" is str as you say it should be:

Feb  6 23:20:01 mimmi setroubleshoot: [sig.ERROR] type(description) = <type 'str'>

Any other test I can do to help?

(In reply to comment #1)
> Also, by any chance did you edit /etc/setroubleshoot/setroubleshoot.cfg and
> modify the encoding?

Not that I can remember.  And an "rpm -Vf" on it agrees with me that it is unchanged.

> Which version of Python are you running?

Comment 4 Bug Zapper 2009-11-18 04:10:05 EST
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
Comment 5 Göran Uddeborg 2009-11-21 16:32:20 EST
The current version of setroubleshoot-server uses sedispatch called from auditd.  In this configuration, the alert messages are not translated at all any more.  So this problem doesn't show.  One could probably argue if it is "fixed", or maybe only "hidden".
Comment 6 Daniel Walsh 2009-11-23 10:21:39 EST
There is another bug filed about the translations in F12.
Comment 7 Göran Uddeborg 2009-11-23 16:14:28 EST
You refer to bug 539286 I assume?  I tried the command you suggested there, and get a backtrace which looks quite similar to what I reported in comment 0.

22:03 mimmi$ sudo sealert -a /var/log/audit/audit.log
[sudo] password for root: 
100% doneERROR: failed to read complete file, 2405705 bytes read out of total 2405455 bytes (/var/log/audit/audit.log)
found 11 alerts in /var/log/audit/audit.log

Traceback (most recent call last):
  File "/usr/bin/sealert", line 799, in on_analyzer_state_change
  File "/usr/bin/sealert", line 818, in output_results
    print siginfo.format_text()
  File "/usr/lib64/python2.6/site-packages/setroubleshoot/signature.py", line 467, in format_text
    description = self.description_adjusted_for_permissive()
  File "/usr/lib64/python2.6/site-packages/setroubleshoot/signature.py", line 368, in description_adjusted_for_permissive
    return _('<font color="0000FF">[%s]</font><p>%s') % (permissive_msg, self.solution.problem_description)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 21: ordinal not in range(128)

This was with setroubleshoot-server-2.2.46-1.fc12.x86_64.
Comment 8 Daniel Walsh 2010-01-19 16:05:15 EST
Fixed in setroubleshoot-2.2.57-1.fc12
Comment 9 Göran Uddeborg 2010-02-01 10:52:51 EST
I just verified the sealert command no longer crashes with 2.2.60-1.fc12

Note You need to log in before you can comment on or make changes to this bug.