apport python exception for python versions which python-apt is not built on
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Apport |
New
|
Undecided
|
Unassigned | ||
apport (Ubuntu) |
Fix Released
|
Undecided
|
Brian Murray | ||
Bionic |
Fix Released
|
Undecided
|
Brian Murray | ||
Eoan |
Fix Released
|
Undecided
|
Brian Murray | ||
Focal |
Fix Released
|
Undecided
|
Brian Murray | ||
python3.7 (Ubuntu) |
Invalid
|
Medium
|
Unassigned | ||
Bionic |
Won't Fix
|
Medium
|
Unassigned | ||
Eoan |
Won't Fix
|
Medium
|
Unassigned | ||
Focal |
Invalid
|
Medium
|
Unassigned | ||
python3.8 (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Bionic |
Won't Fix
|
Undecided
|
Unassigned | ||
Eoan |
Won't Fix
|
Medium
|
Unassigned | ||
Focal |
Invalid
|
Undecided
|
Unassigned |
Bug Description
[Impact]
apport's python crash handler runs for every installed version of python e.g. on Ubuntu 18.04 LTS it will run for crashes with python3.6 or python3.7 as an interpreter. However, python apt modules are only available for the the supported version of python so the crash handler generates an exception which is annoying.
[Test Case for 18.04]
1) Install the non-default version of python3 e.g. python3.7 on Ubuntu 18.04 LTS.
2) Run 'python3.7 -c 'print hello' and observe a Traceback re apt_pkg not being found.
With the version of python3-apport from -proposed you'll not receive the Traceback from step # 2.
[Test Case for 20.04]
1) Install python3.7 and python3.8 on an Ubuntu 19.10 system
2) Upgrade from 19.10 to 20.04 LTS and keep python3.7 installed
3) Run 'python3.7 -c 'print hello' and observe a Traceback re apt_pkg not being found.
With the version of python3-apport from -proposed you'll not receive the Traceback from step # 2
[Regression Potential]
Its possible the crash handler change is incorrect so it should be confirmed that we still get python crashes about the system version of python. One way to do this is to run 'apport-cli coreutils < /dev/null'.
[Original Description]
it seems apport installs an exception hook whenever running python3.
This hook is apparently installed for python3.7 too.
This exception handler has a dependency on apt_pkg, which is a binary that is not compatible with python3.7 it seems (you can't import it, see below)
As a result, whenever I run a python3.7 script and run into an exception (which happens often when writing code), I get an additional exception in the exception handler + a copy of the original exception, so three stacktraces in total.
A solution would be to only install the exception hook for the system python i.e. python3.6
$ lsb_release -rd
Description: Ubuntu 18.04 LTS
Release: 18.04
apport: 2.20.9-0ubuntu7
python-apt: 1.6.0
python3.7: 3.7.0~b3-1
Demo with a trivial error:
$ python3 -c 'print hello'
File "<string>", line 1
print hello
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(hello)?
$ python3.7 -c 'print hello'
File "<string>", line 1
print hello
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(hello)?
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/
from apport.report import Report
File "/usr/lib/
import apport.fileutils
File "/usr/lib/
from apport.
File "/usr/lib/
import apt
File "/usr/lib/
import apt_pkg
ModuleNotFoundE
Original exception was:
File "<string>", line 1
print hello
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(hello)?
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.excepthook
<function apport_excepthook at 0x7fdf2b99a620>
>>> import apt_pkg
>>> apt_pkg.__file__
'/usr/lib/
>>>
Python 3.7.0b3 (default, Mar 30 2018, 04:35:22)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.excepthook
<function apport_excepthook at 0x7f29a6eebea0>
>> import apt_pkg
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundE
Changed in apport (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → Medium |
tags: | added: rls-ff-incoming |
tags: | removed: rls-ff-incoming |
tags: | added: id-5de941fa03cfeb8f3edbe11c |
affects: | apport (Ubuntu Focal) → python3.7 (Ubuntu Focal) |
Changed in python3.7 (Ubuntu Focal): | |
status: | Triaged → Invalid |
Changed in python3.8 (Ubuntu Focal): | |
status: | New → Invalid |
summary: |
- apport python exception handler messes up python3.7 + apport python exception for python versions which python-apt is not + built on |
Changed in python3.7 (Ubuntu Bionic): | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in python3.7 (Ubuntu Eoan): | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in python3.8 (Ubuntu Eoan): | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in python3.8 (Ubuntu Bionic): | |
status: | New → Triaged |
Changed in python-apt (Ubuntu Bionic): | |
status: | New → Invalid |
Changed in python-apt (Ubuntu Eoan): | |
status: | New → Invalid |
Changed in python-apt (Ubuntu Eoan): | |
assignee: | nobody → Brian Murray (brian-murray) |
status: | Invalid → In Progress |
affects: | python-apt (Ubuntu) → apport (Ubuntu) |
Changed in apport (Ubuntu): | |
assignee: | nobody → Brian Murray (brian-murray) |
status: | Invalid → In Progress |
Changed in apport (Ubuntu Bionic): | |
assignee: | nobody → Brian Murray (brian-murray) |
status: | Invalid → In Progress |
Changed in python3.7 (Ubuntu Bionic): | |
status: | Triaged → Won't Fix |
Changed in python3.7 (Ubuntu Eoan): | |
status: | Triaged → Won't Fix |
Changed in python3.8 (Ubuntu Bionic): | |
status: | Triaged → Won't Fix |
Changed in python3.8 (Ubuntu Eoan): | |
status: | Triaged → Won't Fix |
description: | updated |
Changed in apport (Ubuntu Focal): | |
status: | Invalid → New |
description: | updated |
Changed in apport (Ubuntu Focal): | |
assignee: | nobody → Brian Murray (brian-murray) |
status: | New → In Progress |
python 3.7 is not a supported version, hence modules are not built for it.