pydoc > apport

Help on package apport:

NAME
    apport - Apport Python module.

PACKAGE CONTENTS
    REThread
    crashdb
    crashdb_impl (package)
    fileutils
    hookutils
    logging
    packaging
    packaging_impl (package)
    report
    sandboxutils
    ui
    user_group

CLASSES
    problem_report.ProblemReport(collections.UserDict)
        apport.report.Report

    class Report(problem_report.ProblemReport)
     |  Report(problem_type: str = 'Crash', date: str | None = None) -> None
     |
     |  A problem report specific to apport (crash or bug).
     |
     |  This class wraps a standard ProblemReport and adds methods for collecting
     |  standard debugging data.
     |
     |  Method resolution order:
     |      Report
     |      problem_report.ProblemReport
     |      collections.UserDict
     |      collections.abc.MutableMapping
     |      collections.abc.Mapping
     |      collections.abc.Collection
     |      collections.abc.Sized
     |      collections.abc.Iterable
     |      collections.abc.Container
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(self, problem_type: str = 'Crash', date: str | None = None) -> None
     |      Initialize a fresh problem report.
     |
     |      date is the desired date/time string; if None (default), the current
     |      local time is used.
     |
     |      If the report is attached to a process ID, this should be set in
     |      self.pid, so that e. g. hooks can use it to collect additional data.
     |
     |  add_gdb_info(self, rootdir: str | None = None, gdb_sandbox: str | None = None) -> None
     |      Add information from gdb.
     |
     |      This requires that the report has a CoreDump and an
     |      ExecutablePath. This adds the following fields:
     |      - Registers: Output of gdb's 'info registers' command
     |      - Disassembly: Output of gdb's 'x/16i $pc' command
     |      - Stacktrace: Output of gdb's 'bt full' command
     |      - ThreadStacktrace: Output of gdb's 'thread apply all bt full' command
     |      - StacktraceTop: simplified stacktrace (topmost 5 functions) for inline
     |        inclusion into bug reports and easier processing
     |      - AssertionMessage: Value of __abort_msg, __glib_assert_msg, or
     |        __nih_abort_msg if present
     |
     |      The optional rootdir can specify a root directory which has the
     |      executable, libraries, and debug symbols. This does not require
     |      chroot() or root privileges, it just instructs gdb to search for the
     |      files there.
     |
     |      Raises a OSError if the core dump is invalid/truncated, or OSError if
     |      calling gdb fails, or FileNotFoundError if gdb or the crashing
     |      executable cannot be found.
     |
     |  add_hooks_info(self, ui: apport.ui.HookUI | None = None, package: str | None = None, srcpackage: str | None = None) -> bool
     |      Run hook script for collecting package specific data.
     |
     |      A hook script needs to be in PACKAGE_HOOK_DIR/<Package>.py or in
     |      GENERAL_HOOK_DIR/*.py and has to contain a function 'add_info(report,
     |      ui)' that takes and modifies a Report, and gets an UserInterface
     |      reference for interactivity.
     |
     |      return True if the hook requested to stop the report filing process,
     |      False otherwise.
     |
     |  add_kernel_crash_info(self) -> bool
     |      Add information from kernel crash.
     |
     |      This needs a VmCore in the Report.
     |
     |  add_os_info(self) -> None
     |      Add operating system information.
     |
     |      This adds:
     |      - DistroRelease: NAME and VERSION from /etc/os-release, or
     |        'lsb_release -sir' output
     |      - Architecture: system architecture in distro specific notation
     |      - Uname: uname -srm output
     |
     |  add_package(self, package: str) -> str | None
     |      Add Package: field.
     |
     |      Determine the version of the given package (uses "(not installed") for
     |      uninstalled packages) and add Package: field to report.
     |      This also checks for any modified files.
     |
     |      Return determined package version (None for uninstalled).
     |
     |  add_package_info(self, package: str | None = None) -> None
     |      Add packaging information.
     |
     |      If package is not given, the report must have ExecutablePath.
     |      This adds:
     |      - Package: package name and installed version
     |      - SourcePackage: source package name (if possible to determine)
     |      - PackageArchitecture: processor architecture this package was built
     |        for
     |      - Dependencies: package names and versions of all dependencies and
     |        pre-dependencies; this also checks if the files are unmodified and
     |        appends a list of all modified files
     |
     |  add_proc_environ(self, pid: int | None = None, extraenv: collections.abc.Iterable[str] | None = None, proc_pid_fd: int | None = None) -> None
     |      Add environment information.
     |
     |      If pid is not given, it defaults to the process' current pid.
     |
     |      This adds the following fields:
     |      - ProcEnviron: A subset of the process' environment (only some standard
     |        variables that do not disclose potentially sensitive information,
     |        plus the ones mentioned in extraenv)
     |      - CurrentDesktop: Value of $XDG_CURRENT_DESKTOP, if present
     |
     |  add_proc_info(self, pid: int | str | None = None, proc_pid_fd: int | None = None, extraenv: collections.abc.Iterable[str] | None = None) -> None
     |      Add /proc/pid information.
     |
     |      If neither pid nor self.pid are given, it defaults to the process'
     |      current pid and sets self.pid.
     |
     |      This adds the following fields:
     |      - ExecutablePath: /proc/pid/exe contents; if the crashed process is
     |        interpreted, this contains the script path instead
     |      - InterpreterPath: /proc/pid/exe contents if the crashed process is
     |        interpreted; otherwise this key does not exist
     |      - ExecutableTimestamp: time stamp of ExecutablePath, for comparing at
     |        report time
     |      - ProcEnviron: A subset of the process' environment (only some standard
     |        variables that do not disclose potentially sensitive information,
     |        plus the ones mentioned in extraenv)
     |      - ProcCmdline: /proc/pid/cmdline contents
     |      - ProcStatus: /proc/pid/status contents
     |      - ProcMaps: /proc/pid/maps contents
     |      - ProcAttrCurrent: /proc/pid/attr/current contents, if not "unconfined"
     |      - CurrentDesktop: Value of $XDG_CURRENT_DESKTOP, if present
     |
     |  add_snap_contact_info(self, snap_contact: str) -> None
     |      Load report with information about where it should be filed.
     |
     |      Parse project (e.g. 'subiquity') or source package string
     |      (e.g. 'ubuntu/+source/gnome-calculator') from snap 'contact'.
     |      Additionally, extract any tag/tags defined in the contact URL.
     |
     |  add_snap_info(self, snap)
     |      Add info about an installed Snap.
     |
     |      This adds a Snap: field, containing name, version and channel.
     |      It adds a SnapSource: field, if the snap has a Launchpad contact
     |      defined.
     |
     |  add_user_info(self) -> None
     |      Add information about the user.
     |
     |      This adds:
     |      - UserGroups: system groups the user is in
     |
     |  anonymize(self) -> None
     |      Remove user identifying strings from the report.
     |
     |      This particularly removes the user name, host name, and IPs
     |      from attributes which contain data read from the environment, and
     |      removes the ProcCwd attribute completely.
     |
     |  check_ignored(self) -> bool
     |      Check if current report should not be presented.
     |
     |      Reports can be suppressed by per-user denylisting in
     |      ~/.apport-ignore.xml (in the real UID's home) and
     |      /etc/apport/report-ignore/. For environments where you are only
     |      interested in crashes of some programs, you can also create an
     |      allowlist in /etc/apport/report-only/, everything which does not
     |      match gets ignored then.
     |
     |      This requires the ExecutablePath attribute. Throws a ValueError if the
     |      file has an invalid format.
     |
     |      Privileges may need to be dropped before calling this.
     |
     |  crash_signature(self) -> str | None
     |      Get a signature string for a crash.
     |
     |      This is suitable for identifying duplicates.
     |
     |      For signal crashes this the concatenation of ExecutablePath, Signal
     |      number, and StacktraceTop function names, separated by a colon. If
     |      StacktraceTop has unknown functions or the report lacks any of those
     |      fields, return None. In this case, you can use
     |      crash_signature_addresses() to get a less precise duplicate signature
     |      based on addresses instead of symbol names.
     |
     |      For assertion failures, it is the concatenation of ExecutablePath
     |      and assertion message, separated by colons.
     |
     |      For Python crashes, this concatenates the ExecutablePath, exception
     |      name, and Traceback function names, again separated by a colon.
     |
     |      For suspend/resume failures, this concatenates whether it was a suspend
     |      or resume failure with the hardware identifier and the BIOS version, if
     |      it exists.
     |
     |  crash_signature_addresses(self) -> str | None
     |      Compute heuristic duplicate signature for a signal crash.
     |
     |      This should be used if crash_signature() fails, i. e. Stacktrace does
     |      not have enough symbols.
     |
     |      This approach only uses addresses in the stack trace and does not rely
     |      on symbol resolution. As we can't unwind these stack traces, we cannot
     |      limit them to the top five frames and thus will end up with several or
     |      many different signatures for a particular crash. But these can be
     |      computed and synchronously checked with a crash database at the client
     |      side, which avoids having to upload and process the full report. So on
     |      the server-side crash database we will only have to deal with all the
     |      equivalence classes (i. e. same crash producing a number of possible
     |      signatures) instead of every single report.
     |
     |      Return None when signature cannot be determined.
     |
     |  gdb_command(self, sandbox: str | None, gdb_sandbox: str | None = None) -> tuple[list[str], dict[str, str]]
     |      Build gdb command for this report.
     |
     |      This builds a gdb command for processing the given report, by setting
     |      the file to the ExecutablePath/InterpreterPath, unpacking the core dump
     |      and pointing "core-file" to it (if the report has a core dump), and
     |      setting up the paths when calling gdb in a package sandbox.
     |
     |      When available, this calls "gdb-multiarch" instead of "gdb", for
     |      processing crash reports from foreign architectures.
     |
     |      Return argv list for gdb and any environment variables.
     |
     |  has_useful_stacktrace(self) -> bool
     |      Check whether StackTrace can be considered 'useful'.
     |
     |      The current heuristic is to consider it useless if it either is shorter
     |      than three lines and has any unknown function, or for longer traces, a
     |      minority of known functions.
     |
     |  mark_ignore(self) -> None
     |      Ignore future crashes of this executable.
     |
     |      Add a ignore list entry for this report to ~/.apport-ignore.xml, so
     |      that future reports for this ExecutablePath are not presented to the
     |      user any more.
     |
     |      Throws a ValueError if the file already exists and has an invalid
     |      format.
     |
     |      Privileges may need to be dropped before calling this.
     |
     |  obsolete_packages(self) -> list[str]
     |      Return list of obsolete packages in Package and Dependencies.
     |
     |  search_bug_patterns(self, url: str | None) -> str | None
     |      Check bug patterns loaded from the specified url.
     |
     |      Return bug URL on match, or None otherwise.
     |
     |      The url must refer to a valid XML document with the following syntax:
     |      root element := <patterns>
     |      patterns := <pattern url="http://bug.url"> *
     |      pattern := <re key="report_key">regular expression*</re> +
     |
     |      For example:
     |      <?xml version="1.0"?>
     |      <patterns>
     |          <pattern url="http://bugtracker.net/bugs/1">
     |              <re key="Foo">ba.*r</re>
     |          </pattern>
     |          <pattern url="http://bugtracker.net/bugs/2">
     |              <re key="Package">^\\S* 1-2$</re>
     |              <!-- test for a particular version -->
     |              <re key="Foo">write_(hello|goodbye)</re>
     |          </pattern>
     |      </patterns>
     |
     |  stacktrace_top_function(self) -> str | None
     |      Return topmost function in StacktraceTop.
     |
     |  standard_title(self) -> str | None
     |      Create an appropriate title for a crash database entry.
     |
     |      This contains the topmost function name from the stack trace and the
     |      signal (for signal crashes) or the Python exception (for unhandled
     |      Python exceptions).
     |
     |      Return None if the report is not a crash or a default title could not
     |      be generated.
     |
     |  ----------------------------------------------------------------------
     |  Class methods defined here:
     |
     |  from_systemd_coredump(coredump)
     |      Convert the givin systemd coredump into a problem report.
     |
     |      The following keys are not used:
     |       * COREDUMP_CGROUP (str)
     |       * COREDUMP_COMM (str)
     |       * COREDUMP_CONTAINER_CMDLINE (str)
     |       * COREDUMP_GID (int)
     |       * COREDUMP_HOSTNAME (str)
     |       * COREDUMP_OPEN_FDS (str)
     |       * COREDUMP_OWNER_UID (str)
     |       * COREDUMP_PACKAGE_JSON (str)
     |       * COREDUMP_PACKAGE_NAME
     |       * COREDUMP_PACKAGE_VERSION
     |       * COREDUMP_PROC_AUXV (bytes)
     |       * COREDUMP_PROC_CGROUP (str)
     |       * COREDUMP_PROC_LIMITS (str)
     |       * COREDUMP_PROC_MOUNTINFO (str)
     |       * COREDUMP_RLIMIT (str)
     |       * COREDUMP_ROOT (str)
     |       * COREDUMP_SESSION
     |       * COREDUMP_SLICE (str)
     |       * COREDUMP_UID (int)
     |       * COREDUMP_UNIT (str)
     |       * COREDUMP_USER_UNIT (str)
     |       * MESSAGE (str)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  __abstractmethods__ = frozenset()
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from problem_report.ProblemReport:
     |
     |  __setitem__(self, k: str, v: bytes | problem_report.CompressedFile | problem_report.CompressedValue | str | tuple) -> None
     |
     |  add_tags(self, tags: collections.abc.Iterable[str]) -> None
     |      Add tags to the report. Duplicates are dropped.
     |
     |  add_to_existing(self, reportfile: str, keep_times: bool = False) -> None
     |      Add this report's data to an already existing report file.
     |
     |      The file will be temporarily chmod'ed to 000 to prevent frontends
     |      from picking up a hal-updated report file. If keep_times
     |      is True, then the file's atime and mtime restored after updating.
     |
     |  extract_keys(self, file: gzip.GzipFile | typing.BinaryIO, bin_keys: collections.abc.Iterable[str] | str, directory: str) -> None
     |      Extract only given binary elements from the problem report.
     |
     |      Binary elements like kernel crash dumps can be very big. This method
     |      extracts directly files without loading the report into memory.
     |
     |  get_tags(self) -> set[str]
     |      Return the set of tags.
     |
     |  get_timestamp(self) -> int | None
     |      Get timestamp (seconds since epoch) from Date field.
     |
     |      Return None if it is not present.
     |
     |  has_removed_fields(self) -> bool
     |      Check if the report has any keys which were not loaded.
     |
     |      This could happen when using binary=False in load().
     |
     |  load(self, file: gzip.GzipFile | typing.BinaryIO, binary: Union[bool, Literal['compressed']] = True, key_filter: collections.abc.Iterable[str] | None = None) -> None
     |      Initialize problem report from a file-like object.
     |
     |      If binary is False, binary data is not loaded; the dictionary key is
     |      created, but its value will be an empty string. If it is True, it is
     |      transparently uncompressed and available as dictionary byte array
     |      values. If binary is 'compressed', the compressed value is retained,
     |      and the dictionary value will be a CompressedValue object. This is
     |      useful if the compressed value is still useful (to avoid recompression
     |      if the file needs to be written back).
     |
     |      file needs to be opened in binary mode.
     |
     |      If key_filter is given, only those keys will be loaded.
     |
     |      Files are in RFC822 format, but with case sensitive keys.
     |
     |  new_keys(self) -> set[str]
     |      Return newly added keys.
     |
     |      Return the set of keys which have been added to the report since it
     |      was constructed or loaded.
     |
     |  sorted_items(self, keys: collections.abc.Iterable[str] | None = None) -> collections.abc.Iterator[tuple[str, bytes | problem_report.CompressedValue | str | tuple]]
     |      Iterate over all non-internal items sorted.
     |
     |      The most interesting fields will be returned first. The remaining
     |      items will be returned in alphabetical order. Keys starting with
     |      an underscore are considered internal and are skipped. Also values
     |      that are None will be skipped.
     |
     |      If keys is provided, only those keys will be iterated over.
     |
     |  write(self, file: <class 'BinaryIO'>, only_new: bool = False) -> None
     |      Write information into the given file-like object.
     |
     |      If only_new is True, only keys which have been added since the last
     |      load() are written (i. e. those returned by new_keys()).
     |
     |      If a value is a string, it is written directly. Otherwise it must be a
     |      tuple of the form (file, encode=True, limit=None, fail_on_empty=False).
     |      The first argument can be a file name or a file-like object,
     |      which will be read and its content will become the value of this key.
     |      'encode' specifies whether the contents will be
     |      gzip compressed and base64-encoded (this defaults to True). If limit is
     |      set to a positive integer, the file is not attached if it's larger
     |      than the given limit, and the entire key will be removed. If
     |      fail_on_empty is True, reading zero bytes will cause an OSError.
     |
     |      file needs to be opened in binary mode.
     |
     |      Files are written in RFC822 format.
     |
     |  write_mime(self, file, attach_treshold=5, extra_headers=None, skip_keys=None, priority_fields=None)
     |      Write MIME/Multipart RFC 2822 formatted data into file.
     |
     |      file must be a file-like object, not a path.  It needs to be opened in
     |      binary mode.
     |
     |      If a value is a string or a CompressedValue, it is written directly.
     |      Otherwise it must be a tuple containing the source file and an optional
     |      boolean value (in that order); the first argument can be a file name or
     |      a file-like object, which will be read and its content will become the
     |      value of this key.  The file will be gzip compressed, unless the key
     |      already ends in .gz.
     |
     |      attach_treshold specifies the maximum number of lines for a value to be
     |      included into the first inline text part. All bigger values (as well as
     |      all non-ASCII ones) will become an attachment, as well as text
     |      values bigger than 1 kB.
     |
     |      Extra MIME preamble headers can be specified, too, as a dictionary.
     |
     |      skip_keys is a set/list specifying keys which are filtered out and not
     |      written to the destination file.
     |
     |      priority_fields is a set/list specifying the order in which keys should
     |      appear in the destination file.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from problem_report.ProblemReport:
     |
     |  is_binary(string: bytes | str) -> bool
     |      Check if the given strings contains binary data.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from collections.UserDict:
     |
     |  __contains__(self, key)
     |      # Modify __contains__ and get() to work like dict
     |      # does when __missing__ is present.
     |
     |  __copy__(self)
     |
     |  __delitem__(self, key)
     |
     |  __getitem__(self, key)
     |
     |  __ior__(self, other)
     |
     |  __iter__(self)
     |
     |  __len__(self)
     |
     |  __or__(self, other)
     |      Return self|value.
     |
     |  __repr__(self)
     |      Return repr(self).
     |
     |  __ror__(self, other)
     |      Return value|self.
     |
     |  copy(self)
     |
     |  get(self, key, default=None)
     |      D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from collections.UserDict:
     |
     |  fromkeys(iterable, value=None)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from collections.UserDict:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from collections.abc.MutableMapping:
     |
     |  clear(self)
     |      D.clear() -> None.  Remove all items from D.
     |
     |  pop(self, key, default=<object object at 0x7fc2832841d0>)
     |      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
     |      If key is not found, d is returned if given, otherwise KeyError is raised.
     |
     |  popitem(self)
     |      D.popitem() -> (k, v), remove and return some (key, value) pair
     |      as a 2-tuple; but raise KeyError if D is empty.
     |
     |  setdefault(self, key, default=None)
     |      D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
     |
     |  update(self, other=(), /, **kwds)
     |      D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.
     |      If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
     |      If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
     |      In either case, this is followed by: for k, v in F.items(): D[k] = v
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from collections.abc.Mapping:
     |
     |  __eq__(self, other)
     |      Return self==value.
     |
     |  items(self)
     |      D.items() -> a set-like object providing a view on D's items
     |
     |  keys(self)
     |      D.keys() -> a set-like object providing a view on D's keys
     |
     |  values(self)
     |      D.values() -> an object providing a view on D's values
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from collections.abc.Mapping:
     |
     |  __hash__ = None
     |
     |  __reversed__ = None
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from collections.abc.Collection:
     |
     |  __subclasshook__(C)
     |      Abstract classes can override this to customize issubclass().
     |
     |      This is invoked early on by abc.ABCMeta.__subclasscheck__().
     |      It should return True, False or NotImplemented.  If it returns
     |      NotImplemented, the normal algorithm is used.  Otherwise, it
     |      overrides the normal algorithm (and the outcome is cached).
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from collections.abc.Iterable:
     |
     |  __class_getitem__ = GenericAlias(...)
     |      Represent a PEP 585 generic type
     |
     |      E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).

FUNCTIONS
    error(msg, *args)
        Print out an error message.

    fatal(msg: str, *args: Any) -> NoReturn
        Print out an error message and exit the program.

    log(message, timestamp=False)
        Log the given string to stdout. Prepend timestamp if requested.

    memdbg(checkpoint)
        Print current memory usage.

        This is only done if $APPORT_MEMDEBUG is set.

    unicode_gettext(message)
        Return the localized translation of message.

    warning(msg, *args)
        Print out an warning message.

DATA
    __all__ = ['Report', 'error', 'fatal', 'log', 'memdbg', 'packaging', '...
    packaging = <apport.packaging_impl.apt_dpkg.__AptDpkgPackageInfo objec...

FILE
    /usr/lib/python3/dist-packages/apport/__init__.py


apport □✕
NAME PACKAGE CONTENTS CLASSES
class Report(problem_report.ProblemReport)
FUNCTIONS
error(msg, *args) fatal(msg: str, *args: Any) -> NoReturn log(message, timestamp=False) memdbg(checkpoint) unicode_gettext(message) warning(msg, *args)
DATA FILE

Generated by phpman v4.12.29 · Markdown · JSON Author: Che Dong Under GNU General Public License
2026-12-03 06:38 @216.73.216.10
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^