Bug 41539

Summary: log file not viewable in software update module
Product: UCS Reporter: Florian Best <best>
Component: UMC - Software updateAssignee: Florian Best <best>
Status: CLOSED FIXED QA Contact: Richard Ulmer <ulmer>
Severity: normal    
Priority: P5 CC: gohmann, klaeser
Version: UCS 4.1Keywords: interim-1
Target Milestone: UCS 4.2Flags: best: Patch_Available+
Hardware: Other   
OS: Linux   
See Also: https://forge.univention.org/bugzilla/show_bug.cgi?id=28070
What kind of report is it?: Bug Report What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 3: Will affect average number of installed domains How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.103 Enterprise Customer affected?:
School Customer affected?: ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional): Error handling, External feedback
Max CVSS v3 score:

Description Florian Best univentionstaff 2016-06-13 08:04:54 CEST
If the log contains non-utf8-able characters the log view crashes:

Version: 4.1-2 errata197 (Vahr)

Remark: I just wanted to see the join-logs. :(
On the server the logfile is available.

Gr!

Traceback(591c6c5cd74409e5d867805deef3de43):
Execution of command 'join/logview' has failed:

Traceback (most recent call last):
  File "%PY2.7%/univention/management/console/base.py", line 283, in execute
    function(self, request)
  File "%PY2.7%/univention/management/console/modules/decorators.py", line 320, in _response
    self.finished(request.id, result[0])
  File "%PY2.7%/univention/management/console/base.py", line 401, in finished
    self.result(res)
  File "%PY2.7%/univention/management/console/base.py", line 405, in result
    self.signal_emit('success', response)
  File "%PY2.7%/notifier/signals.py", line 75, in signal_emit
    self.__signals[ signal ].emit( *args )
  File "%PY2.7%/notifier/signals.py", line 41, in emit
    cb( *args )
  File "%PY2.7%/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "%PY2.7%/univention/management/console/protocol/modserver.py", line 118, in _reply
    self.response(msg)
  File "%PY2.7%/univention/management/console/protocol/modserver.py", line 350, in response
    self.__queue += str(msg)
  File "%PY2.7%/univention/management/console/protocol/message.py", line 337, in __str__
    return Message._formattedMessage(self._id, self._type, self.mimetype, self.command, body, self.arguments)
  File "%PY2.7%/univention/management/console/protocol/message.py", line 130, in _formattedMessage
    data = json.dumps(body)
  File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 321, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line 237, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line 311, in iterencode
    return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb0 in position 88365: invalid start byte
Comment 1 Florian Best univentionstaff 2016-06-13 08:05:21 CEST
Reported again, 4.1-2 errata191 (Vahr)

Remark: I just installed the latest updates, so version is 4.1-2
Comment 2 Florian Best univentionstaff 2016-06-13 08:13:29 CEST
diff --git a/base/univention-updater/umc/python/updater/__init__.py b/base/univention-updater/umc/python/updater/__init__.py
index 05f1236..d252a8b 100644
--- a/base/univention-updater/umc/python/updater/__init__.py
+++ b/base/univention-updater/umc/python/updater/__init__.py
@@ -488,7 +488,7 @@ def _logview(self, fname, count):
                                        if (count < 0):
                                                count += 1
                                        else:
-                                               lines.append(line.rstrip())
+                                               lines.append(line.rstrip().decode('utf-8', 'replace'))
                                                if (count > 0) and (len(lines) > count):
                                                        lines.pop(0)
                except (IOError, OSError):
Comment 3 Alexander Kläser univentionstaff 2016-09-06 13:39:00 CEST
Same traceback has been reported at Bug 28070.
Comment 4 Florian Best univentionstaff 2016-09-22 11:55:57 CEST
Reproduce via:
printf '\xe4' >> /var/log/univention/updater.log
Comment 5 Florian Best univentionstaff 2016-09-29 16:01:40 CEST
Patch applied, changelog added.

univention-updater (12.0.1-1):
r72900 | Bug #41539: non-UTF-8 characters don't cause a crash when viewing the logfile anymore
Comment 6 Florian Best univentionstaff 2017-01-24 11:00:09 CET
Same problem in the join logview:

univention-join (9.0.2-1):
r76040 | Bug #41539: fix decoding error if logfile contains non-utf-8 character
Comment 7 Richard Ulmer univentionstaff 2017-01-24 11:42:11 CET
Fixed bug in univention-updater (4.2): Verified
Fixed bug in univention-join (4.2): Verified
Changelog: Ok
Comment 8 Stefan Gohmann univentionstaff 2017-04-04 18:29:18 CEST
UCS 4.2 has been released:
 https://docs.software-univention.de/release-notes-4.2-0-en.html
 https://docs.software-univention.de/release-notes-4.2-0-de.html

If this error occurs again, please use "Clone This Bug".