我使用tcllib v1.3在TCL 8.5上运行tclhttpd,我遇到了一个非常奇怪的问题:
# tclsh8.5 bin/httpd.tcl
<Snip>
/home/enigma/tclhttpd3.5.1/bin/../custom/dodirs.tcl: couldn't read file "/home/enigma/tclhttpd3.5.1/bin/../custom/dodirs.tcl": no such file or directory
/home/enigma/tclhttpd3.5.1/bin/../custom/faq.tcl: couldn't read file "/home/enigma/tclhttpd3.5.1/bin/../custom/faq.tcl": no such file or directory
/home/enigma/tclhttpd3.5.1/bin/../custom/hello.tcl: couldn't read file "/home/enigma/tclhttpd3.5.1/bin/../custom/hello.tcl": no such file or directory
/home/enigma/tclhttpd3.5.1/bin/../custom/mypage.tcl: couldn't read file "/home/enigma/tclhttpd3.5.1/bin/../custom/mypage.tcl": no such file or directory
因此,我在“加载客户代码”部分编辑了文件bin/httpdthread.tcl
并添加了以下调试:
foreach f [lsort -dictionary [glob -nocomplain [file join $Config(library) *.tcl]]] {
###### START MY DEBUG
if {1} {
Stderr "Considering $f..."
if { [file isfile $f] == 1} {
Stderr "File looks good"
} else {
Stderr "ERROR"
}
}
###### END MY DEBUG
if {[string compare [file tail $f] "pkgIndex.tcl"] == 0} {
Stderr "Continuing NOT loading"
continue
} elseif {[catch {source $f} err]} {
Stderr "$f: $err"
} elseif {$Config(debug)} {
Stderr "Loaded [file tail $f]: $err"
}
}
通过添加少量调试,服务器可以找到上述文件并开始正常运行。有谁知道可能是什么问题?我不认为我的额外调试应该改变了行为。 [file is file...]
会以某种方式影响后期source
语句中的if
吗?如果我将调试设置为if {0} {...
,则会再次出现文件错误。
答案 0 :(得分:0)
答案似乎是它不喜欢从远程安装的目录运行tclhttp服务器。我这样做是一个快速的脏测试,看看服务器是否会在我的目标上运行...
在目标本地存储上复制tclhttp会删除此错误。但奇怪的是,file isfile
命令以某种方式允许TCL从远程安装位置获取自定义命令TCl脚本!无法解释这一点!