This file is indexed.

/usr/share/doc/pycmail/examples/example.pycmailrc-duplicate is in pycmail 0.1.6.

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
#!/usr/bin/python

# simple example to show how to detect duplicate mails
# based on contribution by Samuel Krempp

import md5, cPickle

md = USERHOME+"/Mail/"


class MsgCache:
    def __init__(self, entries = 5):
        self.data = entries*[0]
        self.position = 0
        self.entries = entries

    def add(self, value):
        self.data[self.position] = value
        self.position = self.position+1
        if self.position >= self.entries:
            self.position = 0

    def resize(self, newentries):
        if newentries == self.entries:
            return
        if newentries < self.entries:
            self.data = self.data[:newentries]  # fixme
            if self.position >= newentries:
                self.position = newentries-1
        else:
            self.data = self.data + (newentries-self.entries)*[0]
        self.entries = newentries



def Duplicate(hashfile="~/Mail/.msgid_cache", entries=5):
    "test for duplicate mails"

    hashfile = os.path.expanduser(hashfile)
    dotlock(hashfile, retries=6, locktimeout=10) # wait up to 1 minute before forcing lock
    if os.path.isfile(md+".msgid_cache"):
        try:
            fd=open(hashfile, "r")
            msgcache=cPickle.load(fd)
            fd.close()
        except:  # something wrong - probably corrupt cache file
            msgcache=MsgCache()
        msgcache.resize(newentries=entries)
    else:
        msgcache = MsgCache()

    msg_hash=mailmsg.getheader("Message-ID") or ""
    msg_hash=msg_hash + FROM + TO
    msg_hash=md5.new(msg_hash).digest()

    if msg_hash in msgcache.data:
        Debug("Duplicate found", 2)
        Junk()
        dotunlock(hashfile)
        return 1
    else:
        msgcache.add(msg_hash)
        fd=open(hashfile, "w")
        cPickle.dump(msgcache, fd)
        fd.close()
        dotunlock(hashfile)
        return 0


if Duplicate():
    Debug("Duplicate found", 2)
    Junk()