Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 712762 - app-portage/elogv-0.7.8-r1 crashes when a log file contains characters not in current locale's charset
Summary: app-portage/elogv-0.7.8-r1 crashes when a log file contains characters not in...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Third-Party Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sebastian Pipping
URL:
Whiteboard:
Keywords: NeedPatch
Depends on:
Blocks:
 
Reported: 2020-03-15 21:11 UTC by Alexander Miller
Modified: 2023-12-13 01:36 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Miller 2020-03-15 21:11:00 UTC
I have a few elog files that contain non-ASCII characters. With LC_ALL=C, elogv (built for Python 3.6) crashes during startup while reading one of these files. It prints an empty frame (which I've omitted except for the bottom line) and the following traceback:

Traceback (most recent call last):────── Press F1 or h to show the help screen ┘
  File "/usr/lib/python-exec/python3.6/elogv", line 693, in <module>
    curses.wrapper(ElogViewer)
  File "/usr/lib64/python3.6/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/lib/python-exec/python3.6/elogv", line 236, in __init__
    self.init_screen()
  File "/usr/lib/python-exec/python3.6/elogv", line 373, in init_screen
    self.fill_file_pad()
  File "/usr/lib/python-exec/python3.6/elogv", line 482, in fill_file_pad
    self.packages.append( (filepath, cat, pn, date, self.get_class(filepath)) )
  File "/usr/lib/python-exec/python3.6/elogv", line 536, in get_class
    classes = re.findall("LOG:|INFO:|WARN:|ERROR:", f.read())
  File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 86: ordinal not in range(128)

Clearly elogv shouldn't assume that the character encoding of elog files is valid for the current locale, and it mustn't crash even if they contain garbage.
Comment 1 Sebastian Pipping gentoo-dev 2020-04-19 14:51:58 UTC
I agree that we have a bug here but I don't see high priority with this.  Can you help out with a patch against latest Git master of elogv (https://gitweb.gentoo.org/proj/elogv.git/)?