apport Python exception hook too aggressive
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apport (Ubuntu) |
Fix Released
|
Undecided
|
Martin Pitt |
Bug Description
Binary package hint: apport
I'm a Python developer. After upgrading to Feisty, I noticed the existence of a package called apport that had a bug in it. This is not about that
apport bug (reported elsewhere), about about a general problem I have with the way it works.
When an exception happens in a Python program that was started through a script with the executable flag set, apport's exception handling kicks in, through /var/lib/
Having a such heavy-handed exception hook is pretty bad news for me. My build tools (zc.buildout) generate Python scripts with the executable flag set all the time, and now I have Ubuntu's error handling to worry about, which isn't starting out by inspiring a lot of confidence by having a bug in it. I can see what you're trying to accomplish here: you want executable software to hook into Ubuntu's bug reporting system. But perhaps there is a better way? Only let the hook kick in for executable scripts that are installed under /usr, perhaps, instead of for *all* executable Python scripts, no matter where they are installed (such as in my home directory). After all, the intent of this seems to be to notice problems with ubuntu-managed Python software, not with software I happen to be writing in my home directory.
Changed in apport: | |
assignee: | nobody → pitti |
status: | In Progress → Fix Committed |
Indeed the current hook already does not create a report for scripts in your home directory:
if not apport. fileutils. likely_ packaged( binary) :
return
which returns true if the executable path starts with the usual system directories (/usr/bin, /lib, etc.).
So, if I understood you correctly, 'import apport.report' is too heavy here? The code can certainly be reshuffled to postpone that import until after above check, which would reduce the amount of parsed code for an exception in non-packaged Python programs.