This file is indexed.

/usr/share/pyshared/vamos/vampyr/Messages.py is in undertaker 1.3b-1.1.

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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#
#   utility classes for working in source trees
#
# Copyright (C) 2011 Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
# Copyright (C) 2011 Reinhard Tartler <tartler@informatik.uni-erlangen.de>
#
# 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 3 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, see <http://www.gnu.org/licenses/>.

import re
import logging


class MessageContainer(set):
    def add_message(self, configuration, message):
        for msg in self:
            if msg == message:
                msg.message_is_in_configuration(configuration)
                return
        # Message isn't in configuration already, so just add it
        self.add(message)


class SparseMessage:
    @staticmethod
    def preprocess_messages(lines):
        """Remove the linebreaks introduced by gcc and sparse depending on the line prefix"""
        last_prefix = None
        result = []
        # Remove empty lines
        lines = filter(lambda x: len(x) > 0, lines)
        # Strip coloumn numbers
        lines = map(lambda x: re.sub(r'(:\d+):\d+: ', r'\1: ', x), lines)
        for line in lines:
            m = re.match('^([^ \t]+)([ \t]+)(.*)', line)
            if not m:
                logging.error("Sparse: Failed to parse '%s'", line)
                continue

            if 'originally declared here' in line:
                continue

            if '***' in line:
                continue

            if last_prefix != None and m.group(1) == last_prefix:
                result[-1] += " | " + m.group(3)
                continue
            last_prefix = m.group(1)
            result.append(line)

        return result


    def __init__(self, configuration, line):
        self.configuration = configuration
        self.bare_message = line
        self.in_configurations = set([configuration])
        self.message = ""
        self.location = ""
        self.parse()
        self.is_error = False


    def message_is_in_configuration(self, configuration):
        """Tell this message that it is also in another configuration"""
        self.in_configurations.add(configuration)


    def parse(self):
        message = self.bare_message.split(" ", 2)
        if message[1] == "error:":
            self.is_error = True
        elif message[1] == "warning:":
            self.is_error = False
        else:
            raise RuntimeError("Sparse: Failed to determine criticality of '%s'" % self.bare_message)

        self.location = message[0]
        self.message = message[2]


    def __repr__(self):
        return "<CompileMessage: error: " + str(self.is_error) + \
            " loc: " + self.location + " msg: " + self.message + ">"

    def __hash__(self):
        return hash(self.bare_message)


    def __eq__(self, other):
        if not isinstance(other, SparseMessage):
            return False
        return self.bare_message == other.bare_message


    def get_message(self):
        return self.bare_message


    def get_report(self):
        return self.bare_message + "\n  in %d configs. e.g. in %s" \
               % ( len(self.in_configurations), str(self.configuration))


class GccMessage(SparseMessage):
    @staticmethod
    def preprocess_messages(messages):
        # Remove [-W<flag>]$ messages
        expr = re.compile("\s*\[(-W[^[]+|enabled by default)\]$")
        messages = map(lambda x: re.sub(expr, "", x), messages)
        messages = SparseMessage.preprocess_messages(messages)
        messages = filter(lambda x: re.match(".*:[0-9]+: (warning|error):", x), messages)
        messages = map(lambda x: re.sub(r'(:\d+):\d+: ', r'\1: ', x), messages)
        return messages

    def __init__(self, configuration, line):
        SparseMessage.__init__(self, configuration, line)

    def __hash__(self):
        return self.location.__hash__()

    def __eq__(self, other):
        if not isinstance(other, GccMessage):
            return False
        ret = self.bare_message == other.bare_message

        if self.configuration == other.configuration \
           and self.location == other.location:
            ret = True

        return ret


class ClangMessage(SparseMessage):
    @staticmethod
    def preprocess_messages(messages):
        # Remove [-W<flag>]$ messages
        expr = re.compile("\s*\[(-W[^[]+|enabled by default)\]$")
        messages = map(lambda x: re.sub(expr, "", x), messages)

        messages = filter(lambda x: re.match(".*:[0-9]+:.*(warning|error):", x), messages)
        return messages


    def __init__(self, configuration, line):
        SparseMessage.__init__(self, configuration, line)


    def parse(self):
        message = self.bare_message.split(" ", 2)
        if "error:" == message[1] or "fatal" == message[1]:
            self.is_error = True
        elif message[1] == "warning:" or message[1] == "note:":
            self.is_error = False
        else:
            raise RuntimeError("Clang: Couldn't parse " + self.bare_message)

        self.location = message[0]
        self.message = message[2]

        self.in_configurations = set([self.configuration])