This file is indexed.

/usr/share/apport/package-hooks/aptdaemon.py is in aptdaemon 1.1.1-1ubuntu5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
"""Apport integration to provide better problem reports."""
# Copyright (C) 2010-2011 Sebastian Heinlein <devel@glatzor.de>
#
# Licensed under the GNU General Public License Version 2
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

__author__ = "Sebastian Heinlein <devel@glatzor.de>"

import os
import re

import apport
import apport.hookutils
import apt_pkg

apt_pkg.init()

def add_info(report):
    """Collect and append additional information about a crash.

    Note: Please consider that aptdaemon also manually creates
          apport reports for failed transaction which don't result
          in a crash of aptdaemon, see aptdaemon.crash

    :param report: The apport report of an aptdaemon crash
    """
    # Attach apt configuration
    report["AptConfig"] = apt_pkg.config.dump()
    # Attach the sources list
    sources_list = ""
    etc_main = os.path.join(apt_pkg.config.find_dir("Dir::Etc"),
                            apt_pkg.config.find_file("Dir::Etc::sourcelist"))
    try:
        with open(etc_main) as fd_main:
            sources_list += fd_main.read()
    except:
        pass
    dir_parts = os.path.join(apt_pkg.config.find_dir("Dir::Etc"),
                             apt_pkg.config.find_dir("Dir::Etc::Sourceparts"))
    for filename in os.listdir(dir_parts):
        if not filename.endswith(".list"):
            continue
        try:
            with open(os.path.join(dir_parts, filename)) as fd_part:
                sources_list += fd_part.read()
        except:
            continue
    # Remove passwords from the sources list
    report["SourcesList"] = re.sub("://\w+?:\w+?@", "://USER:SECRET@",
                                   sources_list)

    # Add some logging data
    apport.hookutils.attach_file_if_exists(report, "/var/log/apt/history.log"
                                           "AptHistoryLog")
    apport.hookutils.attach_file_if_exists(report, "/var/log/apt/term.log",
                                           "AptTermLog")
    apport.hookutils.attach_file_if_exists(report, "/var/log/dpkg.log",
                                           "DpkgLog")
    report["SysLog"] = apport.hookutils.recent_syslog(re.compile("AptDaemon"))

# vim:ts=4:sw=4:et