This file is indexed.

/usr/share/pyshared/Quirks/quirkreader.py is in nvidia-common 1:0.2.44.

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
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012 Canonical Ltd.
#
# Authors: Alberto Milone <alberto.milone@canonical.com>
#
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import XKit.xutils
import XKit.xorgparser
import quirkinfo

import tempfile
import os

class Quirk:

    def __init__(self, id=None, handler=[], x_snippet="", match_tags={}):
        self.id = id
        self.handler = handler
        self.x_snippet = x_snippet
        self.match_tags = {}.fromkeys(quirkinfo.dmi_keys, '')

class ReadQuirk:

    def __init__(self, source=None):
        self.source = source
        
        #See if the source is a file or a file object
        #and act accordingly
        file = self.source
        if file == None:
            lines_list = []
        else:
            if not hasattr(file, 'write'):#it is a file
                myfile = open(file, 'r')
                lines_list = myfile.readlines()
                myfile.close()
            else:#it is a file object
                lines_list = file.readlines()
        
        inside_quirk = False
        has_id = False
        has_handler = False
        inside_x_snippet = False
        self._quirks = []

        it = 0
        for line in lines_list:
            if line.strip().startswith('#'):
                continue
            if inside_quirk:
                if inside_x_snippet:

                    if line.lower().strip().startswith('endxorgsnippet'):
                        inside_x_snippet = False
                        continue
                    else:
                        self._quirks[it].x_snippet += line
                else:
                    #not in x_snippet
                    if not has_id and line.lower().strip().startswith('identifier'):
                        has_id = True
                        temp_str = "identifier"
                        id = line[line.lower().rfind(temp_str) + len(
                             temp_str):].strip().replace('"', '')
                        self._quirks[it].id = id
                        del temp_str
                    elif not has_handler and line.lower().strip().startswith('handler'):
                        has_handler = True
                        temp_str = "handler"
                        handler = line[line.lower().rfind(temp_str) + len(
                             temp_str):].strip().replace('"', '')
                        handlers_list = handler.split('|')
                        self._quirks[it].handler = handlers_list
                        del temp_str
                    elif line.lower().strip().startswith('match'):
                        temp_str = "match"
                        temp_bits = line[line.lower().rfind(temp_str) +
                                    len(temp_str):].strip().split('"')
                        tag_match = ''
                        tag_value = ''
                        tag_values = []
                        for elem in temp_bits:
                            if elem.strip():
                                if not tag_match:
                                    tag_match = elem.strip()
                                    #tag_values = []
                                else:
                                    tag_value = elem.strip()
                                    tag_values = tag_value.split('|')
                                    self._quirks[it].match_tags[tag_match] = tag_values
                                    break
                        del temp_bits
                        del temp_str
                        del tag_values
                    elif line.lower().strip().startswith('xorgsnippet'):
                        inside_x_snippet = True
                        self._quirks[it].x_snippet = ""
                        continue
        
                    elif line.lower().strip().startswith('endsection'):
                        #End Quirk
                        inside_quirk = False
                        if not self._quirks[it].id:
                            self._quirks.pop(it)
                        else:
                            it += 1
            else:
                if line.lower().strip().startswith('section') \
                and "quirk" in line.lower():
                    #Begin Quirk
                    inside_quirk = True
                    temp_quirk = Quirk()
                    self._quirks.append(temp_quirk)
                    del temp_quirk
                    continue

    def get_quirks(self):
        return self._quirks


#if __name__ == "__main__":
    #quirk_file = ReadQuirk("quirk_snippet.txt")
    #quirks = quirk_file.get_quirks()
    #for quirk in quirks:
        #print 'Quirk id: "%s"' % quirk.id
        #for tag in quirk.match_tags.keys():
            #print 'Matching "%s" with value "%s"' % (tag, quirk.match_tags[tag])
        #print quirk.x_snippet

    #tmp_file = tempfile.NamedTemporaryFile(mode='w', delete=False)
    #tmp_file.write(quirk.x_snippet)
    #tmp_file.close()

    #tmp_xkit = XKit.xorgparser.Parser(tmp_file.name)
    #print tmp_xkit.globaldict
    #os.unlink(tmp_file.name)