hookutils.py usage of startswith() assumes strings, but objects are bytes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apport (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Bug 1190526 has an associated HookError_
Traceback (most recent call last):
File "/usr/lib/
symb[
File "/usr/share/
apport.
File "/usr/lib/
if contents == '[deleted]' or contents.
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
The python3-specific problem seems to be that startswith() is expecting a value of the same type as 'contents'. The code assumes contents is a string, but its is a byte tuple.
A fix therefore might be "b'[inaccessible'" like this:
if contents == '[deleted]' or contents.
However, I haven't checked all other instances of startswith().
This happens for conffiles which are binary data (ugh!), so we just need to check for that condition.