Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

using tclhttpd with tcl 8.6

779 views
Skip to first unread message

Ralf Fassel

unread,
Sep 12, 2014, 9:41:12 AM9/12/14
to
In a test script I'm using tclhttpd to simulate anm http server.
When I switch to tcl 8.6, the server startup fails because it tries to
execute "file isdirectory ... " in a safe interp:

Error in configuration file "/software/tclhttpd/current/bin/tclhttpd.rc"
:Error: not allowed to invoke subcommand isdirectory of file
while executing
"config::init $Config(config) Config"
(file "/software/tclhttpd/current/bin/httpd.tcl" line 159)
invoked from within
"source /software/tclhttpd/current/bin/httpd.tcl"
(file "/tmp/15322/htdocs/httpd.tcl" line 7)

Using a tcl 8.5 tclsh this works, but some of the 'file' subcommands
have been declared 'unsafe' in 8.6, so this no longer works.

Has anybody used/modified tclhttpd with 8.6? Alternatives?

TNX
R'

Georgios Petasis

unread,
Sep 12, 2014, 1:10:03 PM9/12/14
to
The obvious alternatives are Wub (http://wiki.tcl.tk/15781) or Wibble
(http://wiki.tcl.tk/23626).

George

rf

unread,
Sep 12, 2014, 1:14:25 PM9/12/14
to
this modifications in tclhttpd3.5.1/bin/tclhttpd.rc worked for me

if {0} {
if {[catch {
foreach d [list \
[file join [Config home] ../htdocs] \
[file join [Config home] ../tclhttpd/htdocs]] {
if {[file isdirectory $d]} {
Config docRoot $d
}
}
} err ]} {
Config docRoot [file join [Config home] ../htdocs]
#8.6 workaround "not allowed isdirectory.."
}
}
Config docRoot [file join [Config home] ../htdocs]

# library - the name of the file system directory containing
# custom code you want to graft into TclHttpd.

if {0} {
foreach d [list \
[file join [Config home] ../custom] \
[file join [Config home] ../tclhttpd/custom]] {
if {[file isdirectory $d]} {
Config library $d
}
}
}
Config library [file join [Config home] ../custom]

Roland Frank

Gerald W. Lester

unread,
Sep 12, 2014, 5:47:52 PM9/12/14
to
On 9/12/14, 8:41 AM, Ralf Fassel wrote:> In a test script I'm using tclhttpd
Pull down the latest (aka head) tclhttpd from http://core.tcl.tk/tclhttpd.

You are seeing bug
http://core.tcl.tk/tclhttpd/tktview?name=93f9e55b95f1ca1329d99531 which was
"fixed" back in May of this year (2014).

--
+------------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald...@kng-consulting.net |
+------------------------------------------------------------------------+

Donal K. Fellows

unread,
Sep 13, 2014, 1:40:51 PM9/13/14
to
On 12/09/2014 22:47, Gerald W. Lester wrote:
> Pull down the latest (aka head) tclhttpd from http://core.tcl.tk/tclhttpd.
>
> You are seeing bug
> http://core.tcl.tk/tclhttpd/tktview?name=93f9e55b95f1ca1329d99531 which
> was "fixed" back in May of this year (2014).

And this stems from the fact that 8.6 turned [file] into a proper
ensemble (and the safe package in 8.6 is pretty hokey even now, and
working on it — typically trying to fix [glob] — usually makes my head
ache).

Donal.
--
Donal Fellows — Tcl user, Tcl maintainer, TIP editor.

Peter Dean

unread,
Sep 13, 2014, 4:55:38 PM9/13/14
to
I also had this

if 0 {
Config CompressProg gzip
foreach d {/bin /usr/bin /usr/local/bin} {
if {[file exists [file join $d gzip]]} {
Config CompressProg [file join $d gzip]
}
}
}
Config CompressProg /usr/bin/gzip

Ralf Fassel

unread,
Sep 14, 2014, 8:50:13 AM9/14/14
to
* "Gerald W. Lester" <Gerald...@KnG-Consulting.net>
| On 9/12/14, 8:41 AM, Ralf Fassel wrote:> In a test script I'm using
| tclhttpd to simulate anm http server.
| > Has anybody used/modified tclhttpd with 8.6? Alternatives?
>
| Pull down the latest (aka head) tclhttpd from http://core.tcl.tk/tclhttpd.
>
| You are seeing bug
| http://core.tcl.tk/tclhttpd/tktview?name=93f9e55b95f1ca1329d99531
| which was "fixed" back in May of this year (2014).

Will check. In the meantime just disabling the offending .rc code and
replacing it with the hardcoded installation pathnames seems also to
work ok.

TNX
R'

EL

unread,
Sep 15, 2014, 6:06:03 PM9/15/14
to
The latest trunk from http://core.tcl.tk/tclhttpd works

(whatever the reason is, that all Tcl projects are changed to yet another versioning system now...)

--
EL

Hypnotoad

unread,
Oct 1, 2014, 4:14:23 PM10/1/14
to
The reason is primarily that sourceforge dropped CVS access. And, at least in my case, establishing my own linode, reserving a domain name, and porting the entire mess to a fossil repository was actually *easier* that trying to retrieve the password to my Sourceforge account.

abhishe...@aurea.com

unread,
Oct 30, 2015, 8:51:58 AM10/30/15
to
Thanks. I faced the same error and your solution helped rectifying this.
But I got this error :
Error in configuration file "./tclhttpd.rc"
:Error: not allowed to invoke subcommand dirname of file
while executing
"config::init $Config(config) Config"
(file "C:\DEV\WorkSpace\LM_TCL_DEBUG.2\httpd.tcl" line 151)
I made changes as per :
http://findsupport.xyz/question/29206362/invoke-hidden-commands-in-slave-interpreters-from-master-interpreter
But I am getting error :
Error in configuration file "./tclhttpd.rc"
:Error: could not find interpreter "myslave"
while executing
"config::init $Config(config) Config"
(file "C:\DEV\WorkSpace\LM_TCL_DEBUG.2\httpd.tcl" line 151)
Please help
Regards
Abhishek

abhishe...@aurea.com

unread,
Nov 4, 2015, 10:59:17 AM11/4/15
to
---------------
Please help me in this regard
Regards
Abhishekk

bre...@google.com

unread,
Jun 8, 2016, 2:10:40 AM6/8/16
to
Sob. So the TclHttpd 3.5.1 I created in 2004 finally stopped working with the latest
version of Tcl, and it took me two years to notice. Insert "shame cube" meme.

My work-around is going to be to install the latest Tcl 8.5 and automatically
edit the bin/httpd.tcl script to use tclsh8.5 instead of tclsh.

It would be super great if someone created a tarball dist that I could just
download, unpack, and execute. I know that is so 20'th century.

Rich

unread,
Jun 8, 2016, 5:56:45 AM6/8/16
to
bre...@google.com wrote:
> On Friday, September 12, 2014 at 6:41:12 AM UTC-7, Ralf Fassel wrote:
> > In a test script I'm using tclhttpd to simulate anm http server.
> > When I switch to tcl 8.6, the server startup fails because it tries to
> > execute "file isdirectory ... " in a safe interp:
> >
> > Error in configuration file "/software/tclhttpd/current/bin/tclhttpd.rc"
> > :Error: not allowed to invoke subcommand isdirectory of file
> > while executing
> > "config::init $Config(config) Config"
> > (file "/software/tclhttpd/current/bin/httpd.tcl" line 159)
> > invoked from within
> > "source /software/tclhttpd/current/bin/httpd.tcl"
> > (file "/tmp/15322/htdocs/httpd.tcl" line 7)
> >
> > Using a tcl 8.5 tclsh this works, but some of the 'file' subcommands
> > have been declared 'unsafe' in 8.6, so this no longer works.
> >
> > Has anybody used/modified tclhttpd with 8.6? Alternatives?

> Sob. So the TclHttpd 3.5.1 I created in 2004 finally stopped working with the latest
> version of Tcl, and it took me two years to notice. Insert "shame cube" meme.

> My work-around is going to be to install the latest Tcl 8.5 and automatically
> edit the bin/httpd.tcl script to use tclsh8.5 instead of tclsh.

> It would be super great if someone created a tarball dist that I could just
> download, unpack, and execute. I know that is so 20'th century.

The fix for 8.6.x is trivial (note that this below does not 'check' for
8.6.x first):

--- tclhttpd3.5.1/lib/config.tcl.orig 2000-08-02 03:06:52.000000000 -0400
+++ tclhttpd3.5.1/lib/config.tcl 2016-06-05 14:51:18.000000000 -0400
@@ -52,6 +52,9 @@

set i [interp create -safe]
interp expose $i file
+ foreach subcommand {isdirectory exists dirname} {
+ interp alias $i ::tcl::file::$subcommand {} file $subcommand
+ }

# Create the slave's Config array, then source the config script

0 new messages