On 28.01.19 18:10, David Osborne wrote:
Thanks Gustaf,

That got me past the immediate problem - but I'm now seeing some further issues which I can't fully explain.

1. Tcl8.5 only - After clock scan : invalid command name "::tcl::clock::scan" 2. Tcl8.5 & Tcl8.6 After ::try .. on error : can't read "magicCodes": no such variable

The errors only seem to happen after the commands are executed on startup within ns/tcl
actually, i cannot reproduce this problem (while i could reproduce the original "::try" issue with Tcl 8.5.19). The underlying problem is that Tcl does some optimization upon initialization of Tcl, assuming a certain initialization sequence. The order on vars, procs and namespaces in NaviServer is more or less random (depending on hash
table populations).

So, i think, it is the best strategy for NaviServer to put the fingers away on stuff
coming from Tcl. The "clock" command seems to populate as well the ::msgcat
namespace (it would be better if it had been named ::tcl::msgcat). When "clock" is called during initialization (where content for the blueprint is collected), then NaviServer puts this as well into the blueprint. I have made now a modification [1] to exclude the ::msgcat namespace as well. All my test continue to work, maybe this is some improvement
for the problem in your configuration.

-g


[1] https://bitbucket.org/naviserver/naviserver/commits/641903183cc8e836109edb06d01450f041aa7818


# cat  ~/test.tcl
package require try
::try {
    ns_log Notice "=== scan returns [clock scan "+365 days"]"
} on error [list message options] {
    ns_log Notice "=== scan fails $message"
    ns_log Notice "=== scan fails $options"
}

# /usr/local/bin/nsd -u nsadmin -c
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: OpenSSL 1.1.1  11 
Sep 2018 initialized
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: nsmain: 
NaviServer/4.99.17 (bb78064b1137+ default tip) starting
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: nsmain: security 
info: uid=1000, euid=1000, gid=1000, egid=1000
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: nsmain: Tcl version: 
8.5.19
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: nsmain: max files: 
soft limit 1073741816, hard limit 1073741816
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Warning: nsmain: rl_cur 
(1073741816) > FD_SETSIZE (1024), select() calls should not be used
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Error: pidfile: failed to 
open pid file '/usr/local/logs/nsd.pid': 'Permission denied'
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: pool default: 
queueLength 90 low water 9 high water 72
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: nsd/init.tcl[default]: booting 
virtual server:  Tcl system encoding: "utf-8"
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: binder: started
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: Using ns_cache 
implemented as a Tcl proc
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Warning: ns_md, ns_hmac, 
ns_hotp and ns_totp are not available
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: === scan returns 
1580252400
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: update interpreter 
to epoch 1, trace deallocate, time 0.002598 secs
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: update interpreter 
to epoch 1, trace none, time 0.002262 secs
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: nsmain: 
NaviServer/4.99.17 (bb78064b1137+ default tip) running
[29/Jan/2019:11:57:09][22340.7f8bfc178740][-main-] Notice: nsmain: security 
info: uid=1000, euid=1000, gid=1000, egid=1000
[29/Jan/2019:11:57:09][22340.7f8beeef0700][-command-] Notice: update 
interpreter to epoch 1, trace none, time 0.002163 secs
[29/Jan/2019:11:57:09][22340.7f8bfc178740][binder] Notice: binder: stopped
[29/Jan/2019:11:57:09][22340.7f8bee62f700][-conn:default:0:0-] Notice: update 
interpreter to epoch 1, trace none, time 0.002218 secs
[29/Jan/2019:11:57:09][22340.7f8bee62f700][-conn:default:0:0-] Notice: thread 
initialized (0.003557 secs)
%



$ uname -a
Linux stretch 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux
$ cat /etc/debian_version
9.6
$ apt-cache policy tcl8.5
tcl8.5:
Installed: 8.5.19-2+b1
Candidate: 8.5.19-2+b1
$ hg clonehttps://bitbucket.org/naviserver/naviserver
$ cd naviserver
$ ./autogen.sh --disable-ipv6 --with-tcl=/usr/lib/tcl8.5 --enable-rpath --enable-threads --enable-symbols
$ make
$ sudo make install
$ cat ~/test.tcl

package require try
::try {
ns_log Notice "[clock scan "+365 days"]"
} on error [list message options] {
ns_log Notice "$message"
ns_log Notice "$options"
}

## Copy test.tcl into tcl dir

$ sudo cp test.tcl /usr/local/ns/tcl/
$ sudo /usr/local/ns/bin/nsd -u nsd -t /usr/local/ns/conf/nsd-config.tcl -c

## Not working

% ::try { puts trying } on error [list message options] { puts error }
can't read "magicCodes": no such variable
% clock scan "+365 days"
invalid command name "::tcl::clock::scan"

## Remove test.tcl from tcl dir

$ sudo rm /usr/local/ns/tcl/test.tcl

## Working

% package require try
1
% ::try { puts trying } on error [list message options] { puts error }
trying
% clock scan "+365 days"
1580169600





On Fri, 25 Jan 2019 at 18:42, Gustaf Neumann <neum...@wu.ac.at <mailto:neum...@wu.ac.at>> wrote:

    On 25.01.19 13:44, David Osborne wrote:
    When attempting to use the tip version of NaviServer, whenever we
    use the tcllib's ::try command (which we need because we're
    running Tcl8.5) we get an error: "unknown namespace in import
    pattern "::tcl::control::try"

    I've tried to simplify the testcase as much as I can to the
    following under Debian Stretch. The error also occurs under
    Debian Jessie.

    Dear David,

    you might try the following change

    
https://bitbucket.org/naviserver/naviserver/commits/0cac39752fbb1026061df8b0a63212584c5f190d

    thanks for the good test specification and case!

    -g


    _______________________________________________
    naviserver-devel mailing list
    naviserver-devel@lists.sourceforge.net
    <mailto:naviserver-devel@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/naviserver-devel



--
David Osborne
Qcode Software Limited
http://www.qcode.co.uk
T: +44 (0)1463 896484



_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


--
Univ.Prof. Dr. Gustaf Neumann
WU Vienna
Institute of Information Systems and New Media
Welthandelsplatz 1, A-1020 Vienna, Austria

_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to