This file is indexed.

/usr/lib/gdesklets/utils/vfs.py is in gdesklets 0.36.1-5+b1.

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
#
# Abstraction layer for VFS operations to move gnomevfs dependency out of the
# core.
#

USE_GNOMEVFS = True

import urllib

try:
    import gnomevfs

    OPEN_READ = gnomevfs.OPEN_READ
    OPEN_WRITE = gnomevfs.OPEN_WRITE

except ImportError:
    try:
        import gnome.vfs as gnomevfs

        OPEN_READ = gnomevfs.OPEN_READ
        OPEN_WRITE = gnomevfs.OPEN_WRITE

    except ImportError:
        log("Using urllib, because gnomevfs isn't available")
        OPEN_READ = "r"
        OPEN_WRITE = "w"

        USE_GNOMEVFS = False



def escape_path(uri):

    try:
        return gnomevfs.escape_string(uri)
    except:
        return escape_path_urllib(uri)

def escape_path_urllib(uri):

    return urllib.quote(uri)



def unescape_path(uri):

    return urllib.unquote(uri)



#
# Reads the entire file and returns its contents.
#
def read_entire_file(uri):

    try:
        uri = gnomevfs.read_entire_file(uri)
    except:
        log("Warning: Couldn't read file \"%s\"." % (uri,))
        raise

    return uri

def read_entire_file_urllib(uri):

    if (not "://" in uri): uri = "file://" + uri

    try:
        uri = urllib.urlopen(uri).read()
    except:
        log("Warning: Couldn't read file \"%s\"." % (uri,))
        raise

    return uri



#
# Opens the given URI and returns a file descriptor.
#
def open(uri, mode = OPEN_READ):

    try:
        fd = gnomevfs.open(uri, mode)
    except:
        log("Warning: Couldn't open file \"%s\"." % (uri,))
        return

    return fd

def open_urllib(uri, mode = OPEN_READ):

    if (not "://" in uri): uri = "file://" + uri

    try:
        fd = urllib.urlopen(uri)
    except:
        log("Warning: Couldn't open file \"%s\"." % (uri,))
        return

    return fd



#
# Returns whether the given URI exists.
#
def exists(uri):

    return gnomevfs.exists(gnomevfs.URI(uri))

def exists_urllib(uri):

    if (not "://" in uri): uri = "file://" + uri

    try:
        urllib.urlopen(uri)
    except:
        return False
    else:
        return True



if (not USE_GNOMEVFS):
    read_entire_file = read_entire_file_urllib
    open = open_urllib
    exists = exists_urllib
    escape_path = escape_path_urllib