Ticket #4381: porttrace_envTMPDIR.patch

File porttrace_envTMPDIR.patch, 1.9 KB (added by opendarwin.org@…, 19 years ago)

patch to src/port1.0/porttrace.tcl to teach it about TMPDIR

  • src/port1.0/porttrace.tcl

    RCS file: /Volumes/src/cvs/od/projects/darwinports/base/src/port1.0/porttrace.tcl,v
    retrieving revision 1.11
    diff -u -r1.11 porttrace.tcl
     
    164164# Private.
    165165# Slave method to read a line from the trace.
    166166proc slave_read_line {chan} {
    167         global ports_list trace_filemap created_list workpath trace_mutex own_mutex
     167        global ports_list trace_filemap created_list workpath trace_mutex own_mutex envtmpdir
    168168
    169169        # Acquire the mutex.
    170170        thread::mutex lock $trace_mutex
     
    219219                                        }
    220220                                }
    221221                        } elseif {$op == "create"} {
    222                                 # Only keep entries not under workpath, under /tmp/, under
     222                                # Only keep entries not under workpath, ignore entries under ENV{TMPDIR}, /tmp/, under
    223223                                # /var/tmp/ and /dev/null
    224224                                if {![string equal -length [string length "/tmp/"] "/tmp/" $path]
     225                                        && !([info exists envtmpdir] && [string equal -length [string length "$envtmpdir"] "$envtmpdir" $path])
    225226                                        && ![string equal -length [string length "/var/tmp/"] "/var/tmp/" $path]
    226227                                        && ![string equal "/dev/null" $path]
    227228                                        && ![string equal -length [string length $workpath] $workpath $path]} {
     
    238239# Slave init method.
    239240proc slave_start {fifo p_workpath mutex} {
    240241        global ports_list trace_filemap created_list trace_fifo_r_chan \
    241                 trace_fifo_w_chan workpath trace_mutex own_mutex
     242                trace_fifo_w_chan workpath trace_mutex own_mutex \
     243                env envtmpdir
    242244        # Save the workpath and the mutex.
    243245        set workpath $p_workpath
    244246        set trace_mutex $mutex
    245247        set own_mutex 0
     248        # capture user's TMPDIR for ignoring path elements created there.
     249        if {[info exists env(TMPDIR)]} {
     250                set envtmpdir $env(TMPDIR);
     251        }
    246252        # Create a virtual filemap.
    247253        filemap create trace_filemap
    248254        set ports_list {}