This file is indexed.

/usr/share/doc/spambayes/pspam/update.py is in spambayes 1.1b1-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
import getopt
import os
import sys

import pspam.database
from pspam.profile import Profile

from spambayes.Options import options

def folder_exists(L, p):
    """Return true folder with path p exists in list L."""
    for f in L:
        if f.path == p:
            return True
    return False

def main(rebuild=False):
    db = pspam.database.open()
    r = db.open().root()

    profile = r.get("profile")
    if profile is None or rebuild:
        # if there is no profile, create it
        profile = r["profile"] = Profile(options["ZODB", "folder_dir"])
        get_transaction().commit()

    # check for new folders of training data
    for ham in options["ZODB", "ham_folders"].split(os.pathsep):
        p = os.path.join(options["ZODB", "folder_dir"], ham)
        if not folder_exists(profile.hams, p):
            profile.add_ham(p)

    for spam in options["ZODB", "spam_folders"].split(os.pathsep):
        p = os.path.join(options["ZODB", "folder_dir"], spam)
        if not folder_exists(profile.spams, p):
            profile.add_spam(p)
    get_transaction().commit()

    # read new messages from folders
    profile.update()
    get_transaction().commit()

    db.close()

if __name__ == "__main__":
    FORCE_REBUILD = False
    opts, args = getopt.getopt(sys.argv[1:], 'F')
    for k, v in opts:
        if k == '-F':
            FORCE_REBUILD = True

    main(FORCE_REBUILD)