Hello Thierry,

so you found the .txt.gz issue already (text files get automatically
compressed by dpkg when they exceed 1 kB or so, thus the reference is
wrong, sorry). Going through your replies one by one, starting with the
first questions:

> Do I understand correctly I would need so create a file (for example)
named : /usr/share/apport/general-hooks/power.py ?

That's right. It should be written so that it exits early on machines
where this doesn't apply (i. e. other architectures), or just guard the
individual steps to avoid confusing error messages. If the hook fails it
won't disrupt the bug/crash reporting process, but one gets the
tracebacks on stderr (which is nice for debugging the hook, but
confusing for users).

> Do you have common functions to put output of commands in logfile ?

Yes, hook_utils.coommand_output(). If you need to run stuff as root
(should be avoided), you can use hookutils.attach_root_command_outputs()
with a set of commands (please only call it once, as it needs to
interactively ask for permission).

BTW, apport's Report objects and the resulting bug reports are not a
single log file, they behave like a dictionary. So you can tell apart
different components of the report, such as different log files /
command outputs / etc.

> do you have common functions to copy config file tree content to log
file or should I create the list of file and copy content of each file
to the logfile ?

There's no helper to copy an entire tree. There's attach_conffiles() for
adding changed conffiles of a particular package, everything else must
be done manually. We don't want to encourage hook writers to generously
attach everything they possibly can, as:

 - it increases the risks of attaching private/sensitive information; so any 
file needs to be carefully treated individually, and potentially anonymized
 - it makes bug reports and uploads too large
 - it's harder for the bug reviewer to see what the relevant information is

So it's generally better for a hook to only attach information if it's
"unusual", i. e. not the default value.

I'll review your other comments/code soon.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1336462

Title:
  Make apport collect some Power information

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1336462/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to