Bug 1202680

Summary: yum-cron crash
Product: Red Hat Enterprise Linux 7 Reporter: Frank Büttner <bugzilla>
Component: yumAssignee: Michal Domonkos <mdomonko>
Status: CLOSED ERRATA QA Contact: Eva Mrakova <emrakova>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0CC: emrakova, fschwarz, helge+fedora, james.antill, milan.kerslager, vmukhame
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: yum-3.4.3-138.el7 Doc Type: If docs needed, set a value
Doc Text:
no docs required
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 05:28:40 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:

Description Frank Büttner 2015-03-17 08:05:29 UTC
Description of problem:
yum-cron crash when sending the email.

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

How reproducible:
every time

Steps to Reproduce:
emit_via = email
email_from = foo
email_to = foo2
email_host = localhost

Actual results:

Traceback (most recent call last):
  File "/usr/sbin/yum-cron", line 711, in <module>
  File "/usr/sbin/yum-cron", line 708, in main
  File "/usr/sbin/yum-cron", line 623, in updatesCheck
    self.downloadUpdates(not self.opts.apply_updates)
  File "/usr/sbin/yum-cron", line 534, in downloadUpdates
  File "/usr/sbin/yum-cron", line 694, in emitMessages
    map(lambda x: x.sendMessages(), self.emitters)
  File "/usr/sbin/yum-cron", line 694, in <lambda>
    map(lambda x: x.sendMessages(), self.emitters)
  File "/usr/sbin/yum-cron", line 227, in sendMessages
    msg = MIMEText(''.join(self.output))
  File "/usr/lib64/python2.7/email/mime/text.py", line 30, in __init__
    self.set_payload(_text, _charset)
  File "/usr/lib64/python2.7/email/message.py", line 226, in set_payload
  File "/usr/lib64/python2.7/email/message.py", line 262, in set_charset
    self._payload = self._payload.encode(charset.output_charset)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 222-223: ordinal not in range(128)

Expected results:
Yum sends an mail about the update.

Comment 2 Milan Kerslager 2015-04-15 12:59:15 UTC
Same problem here. The error message is not produced every time, but sometimes I receive a bunch of them. Then it stop making noise until another bunch of them.

Comment 5 Frank Büttner 2015-11-04 21:44:24 UTC
Today I found the problem.
In the files:
the line
exec /usr/sbin/yum-cron
exec /usr/sbin/yum-cron /etc/yum/yum-cron-hourly.conf
must change to
LANG=C exec /usr/sbin/yum-cron
LANG=C exec /usr/sbin/yum-cron /etc/yum/yum-cron-hourly.conf
than it will work

Comment 6 Frank Büttner 2015-11-26 08:51:38 UTC
The real problem is this line:
msg = MIMEText(''.join(self.output))
from /usr/sbin/yum-cron
If the message contains non ascii char's it crash.
This will happens, because yum will generate it output in respect of the system language. So there are two options, first fix from comment #5 or fix  /usr/sbin/yum-cron by change
msg = MIMEText(''.join(self.output))
msg = MIMEText(''.join(self.output),_charset='utf-8')

Comment 7 Michal Domonkos 2016-02-19 10:48:13 UTC
Upstream pull request:

Comment 11 Felix Schwarz 2016-04-08 08:21:20 UTC
upstream pull request merged since Feb 29 - any extra action required to get this included in RHEL?

Comment 12 Valentina Mukhamedzhanova 2016-04-29 11:37:24 UTC
(In reply to Felix Schwarz from comment #11)
> upstream pull request merged since Feb 29 - any extra action required to get
> this included in RHEL?

No extra action required, this fix will be delivered in RHEL7.3.

Comment 16 errata-xmlrpc 2016-11-04 05:28:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.