← Back to team overview

touch-packages team mailing list archive

[Bug 1336462] Re: Make apport collect some Power information

 

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
Touch seeded packages, which is subscribed to apport in Ubuntu.
https://bugs.launchpad.net/bugs/1336462

Title:
  Make apport collect some Power information

Status in “apport” package in Ubuntu:
  In Progress

Bug description:
  On power/ppc64el system, we would need to enhance current apport reporting tool which some information like file content or commands output including
            "/proc/device-tree/"
              "/proc/loadavg"
              "/proc/locks"
             "/proc/misc"
              "/proc/swaps"
              "/proc/version"
              "/dev/nvram"
              "/var/log/platform"
              "ppc64_cpu --smt"
              "ppc64_cpu --cores-present"
              "ppc64_cpu --cores-on"
              "ppc64_cpu --run-mode"
             "ppc64_cpu --frequency"
             "ppc64_cpu --dscr"

  Readme says : For complete instructions, see /usr/share/doc/apport/package-hooks.txt but
  cat: /usr/share/doc/apport/package-hooks.txt: No such file or directory

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

  Other questions:
  Do you have common functions to put output of commands in logfile ?
  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 ?

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