Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2008-06-17
23:46 • Ticket [1914604fff] tm.tcl TCLX.y_TM_PATH not portable status still Closed ... artifact: 2cbf4539f2 user: andreas_kupries
2008-03-19
00:44 • Closed ticket [1914604fff]. artifact: 479b0cbc1b user: andreas_kupries
2008-03-18
20:48 • Ticket [1914604fff]: 1 change artifact: 376e9bce94 user: dkf
20:48 • Ticket [1914604fff]: 1 change artifact: d34fd42170 user: dkf
19:15 • Ticket [1914604fff]: 1 change artifact: 6be9de61a2 user: juliannoble
2008-03-14
22:50 • New ticket [1914604fff]. artifact: d0dc275218 user: juliannoble

tm.tcl TCLX.y_TM_PATH not portable

Closed / Fixed1914604fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 18 years ago
Descriptionplain2008-03-14 22:50:25
Apache allows only letters numbers and the underscore in the names of environment variables.

(see http://httpd.apache.org/docs/2.2/env.html)

This means TCL8.5_TM_PATH is converted to TCL8_5_TM_PATH in an apache cgi situation for example, and so tcl::tm::list isn't adjusted accordingly.

The Apache docs claim this is for 'portability reasons' so perhaps it crops up elsewhere.

I got around the issue by adjusting tcl::tm::Defaults in lib/tcl8.5/tm.tcl to check for TCLX_y_TM_PATH if TCLX.h_TM_PATH doesn't exist. 


proc ::tcl::tm::Defaults {} {
    global env tcl_platform

    lassign [split [info tclversion] .] major minor
    set exe [file normalize [info nameofexecutable]]

    # Note that we're using [::list], not [list] because [list] means
    # something other than [::list] in this namespace.
    roots [::list \
    [file dirname [info library]] \
    [file join [file dirname [file dirname $exe]] lib] \
    ]

    if {$tcl_platform(platform) eq "windows"} {
set sep ";"
    } else {
set sep ":"
    }
    for {set n $minor} {$n >= 0} {incr n -1} {
set ev TCL${major}.${n}_TM_PATH
if {[info exists env($ev)]} {
    foreach p [split $env($ev) $sep] {
path add $p
    }
} else {
set ev TCL${major}_${n}_TM_PATH
if {[info exists env($ev)]} {
    foreach p [split $env($ev) $sep] {
path add $p
    }
}
}
    }
    return
}
juliannoble Ticket [1914604fff]: 1 change [History diff]2008-03-18 19:15:18
dkf Ticket [1914604fff]: 1 change [History diff]2008-03-18 20:48:23
dkf Ticket [1914604fff]: 1 change [History diff]2008-03-18 20:48:24
andreas_kupriesplain2008-03-19 00:44:31
Logged In: YES 
user_id=75003
Originator: NO

Accepted, with changes. Minor: Used a loop to prevent the replication of the 'path add' loop. Changed semantics a bit as well, now always accepting both forms of the environment variable. I.e. TCL_X_y_TM_PATH is accepted even if TCLX.y_TM_PATH exists too, instead of only when it doesn't exist.
andreas_kupriesplain2008-06-17 23:46:26
Logged In: YES 
user_id=75003
Originator: NO

Updated the documentation (manpage tm.n) in both head and 8.5 branch. Prompted by duplicate [Bug 1996158], i.e. https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1996158&group_id=10894
Log in (anonymous is fine) to add a comment.