This file is indexed.

/usr/share/apport/package-hooks/source_mdadm.py is in mdadm 3.2.3-2ubuntu1.

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

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
'''apport package hook for mdadm

(c) 2009 Canonical Ltd.
Author: Steve Beattie <sbeattie@ubuntu.com>

Based on the ideas in debian's /usr/share/bug/mdadm/script
'''

from apport.hookutils import *
from os import path
import re
import glob
import gzip
import subprocess

def get_initrd_files(pattern):
    '''Extract listing of files from the current initrd which match a regex.

       pattern should be a "re" object.  '''

    (_, _, release, _, _) = os.uname()
    try:
        fd = gzip.GzipFile('/boot/initrd.img-' + release, 'rb')
        cpio = subprocess.Popen(['cpio', '-t'], close_fds=True, stderr=subprocess.STDOUT,
		                stdin=subprocess.PIPE, stdout=subprocess.PIPE)
    except OSError, e:
        return 'Error: ' + str(e)

    out = cpio.communicate(fd.read())[0]
    if cpio.returncode != 0:
       return 'Error: command %s failed with exit code %i %' % (
           'cpio', cpio.returncode, out)

    lines = ' '
    for line in out.splitlines(True):
        if pattern.search(line):
            lines += ' ' + line
    return lines

def add_info(report):
    attach_hardware(report)
    attach_file(report, '/proc/mounts', 'ProcMounts')
    attach_file_if_exists(report, '/etc/mdadm/mdadm.conf', 'mdadm.conf')
    attach_file(report, '/proc/mdstat', 'ProcMDstat')
    attach_file(report, '/proc/partitions', 'ProcPartitions')
    attach_file(report, '/etc/blkid.tab', 'etc.blkid.tab')
    attach_file_if_exists(report, '/boot/grub/menu.lst', 'GrubMenu.lst')
    attach_file_if_exists(report, '/etc/lilo.conf', 'lilo.conf')

    devices = glob.glob("/dev/[hs]d*")
    for dev in devices:
        report['MDadmExamine' + path_to_key(dev)] = command_output(['/sbin/mdadm', '-E', dev])

    initrd_re = re.compile('md[a/]')
    report['initrd.files'] = get_initrd_files(initrd_re)