Andrew,

I agree that the array should be gone after the call of "nsv_unset a".
The plain "Thread" package in Tcl 8.6 shows the same behavior:

/usr/local/src/tcl8.6.2% ./unix/tclsh
% package req Thread
2.7.0
% tsv::set a x 1
1
% tsv::unset a
%  list [tsv::exists a k1] [tsv::exists a k2] [tsv::exists a k3] [tsv::array 
exists a]
0 0 0 0

The behavior is now fixed in the tip branch on bitbucket.

all the best
-gustaf neumann

Am 29.10.14 20:39, schrieb Andrew Piskorski:
> If you do 'nsv_unset myarray', all the keys in the array are removed,
> but the array itself is left behind (which is wrong).  Also, no test
> checked that behavior.  Fixing the test is easy, I did that here:
>
>    
> https://bitbucket.org/apiskors/naviserver/commits/02e64d5e1a5c181b2668c1cf24f7321dc70baed9
>
> The (failing) test output is below.
>
> The bug is probably in NsTclNsvUnsetObjCmd().  The old AOLserver
> 4.0.10 version included special code to handle the "nsv_unset foo"
> objc == 2 case, but Naviserver's re-write in 2008 seems to have left
> that out.
>
> Also, why do both Unset() and Ns_VarUnset() exist?  Ns_VarUnset() is a
> wrapper around Unset(), but it is never actually used, instead other
> code calls Unset() directly.
>
>
> $ make test TCLTESTARGS='-file ns_nsv.test'
> ==== ns_nsv-3.5 nsv_unset array FAILED
> ==== Contents of test case:
>
>      nsv_unset a
>      list [nsv_exists a k1] [nsv_exists a k2] [nsv_exists a k3] [nsv_array 
> exists a]
>
> ---- Result was:
> 0 0 0 1
> ---- Result should have been (exact matching):
> 0 0 0 0
> ==== ns_nsv-3.5 FAILED
>

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

Reply via email to