This file is indexed.

/usr/lib/tcltk/rivet2.1/rivet-tcl/debug.tcl is in libapache2-mod-rivet 2.1.3-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
###
## debug ?-option value? ?-option value?...
##    A command to make debugging more convenient.  Print strings, arrays
##    and the values of variables as specified by the arguments.
##
##    Also allows the setting of an array called debug which will pick up
##    options for all debug commands.
##
##    We create this command in the ::request namespace because we want the
##    user to be able to use the debug array without actually having to set
##    it at the global level.
##
##    Options:
##
##	-subst <on|off> - Each word should be considered a variable and subst'd.
##	-separator <string> - A text string that goes between each variable.
##	-ip <ip address> - A list of IP addresses to display to.
##
## $Id: debug.tcl 1340583 2012-05-19 22:32:19Z mxmanghi $
##
###

namespace eval ::rivet {

    proc debug {args} {

        # starting with 2.1.0 ::RivetUserConf can be created on demand (see ::rivet::inspect)

        array set ::RivetUserConf [dict get [::rivet::inspect] user]

        ## If they've turned off debugging, we don't do anything.

        if {[info exists ::RivetUserConf(Debug)] && !$::RivetUserConf(Debug)} {
            return
        }

        ## We want to save the REMOTE_ADDR for any subsequent calls to debug.
        if {![info exists ::RivetUserConf(REMOTE_ADDR)]} {
            set REMOTE_ADDR [env REMOTE_ADDR]
            set ::RivetUserConf(REMOTE_ADDR) $REMOTE_ADDR
        }


        ## Set some defaults for the options.
        set data(subst) 0
        set data(separator) <br>

        ## Check RivetUserConf for globally set options.
        if {[info exists ::RivetUserConf(DebugIp)]} {
            set data(ip) $::RivetUserConf(DebugIp)
        }
        if {[info exists ::RivetUserConf(DebugSubst)]} {
            set data(subst) $::RivetUserConf(DebugSubst)
        }
        if {[info exists ::RivetUserConf(DebugSeparator)]} {
            set data(separator) $::RivetUserConf(DebugSeparator)
        }

        import_keyvalue_pairs data $args

        if {[info exists data(ip)]} {
            set can_see 0
            foreach ip $data(ip) {
                if {[string match $data(ip)* $::RivetUserConf(REMOTE_ADDR)]} {
                    set can_see 1
                    break
                }
            }
            if {!$can_see} { return }
        }

        if {[string tolower $data(subst)] != "on"} {
            ::rivet::html [join $data(args)]
            return
        }

        set lastWasArray 0
        foreach varName $data(args) {
            upvar $varName var
            if {[array exists var]} {
                parray $varName
                set lastWasArray 1
            } elseif {[info exists var]} {
                if {!$lastWasArray} {
                    ::rivet::html $data(separator)
                }
                ::rivet::html $var
                set lastWasArray 0
            } else {
                if {!$lastWasArray} {
                    ::rivet::html $data(separator)
                }
                ::rivet::html $varName
                set lastWasArray 0
            }
        }
    }
}