Index: modules/struct/ChangeLog
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/struct/ChangeLog,v
retrieving revision 1.14
diff -u -r1.14 ChangeLog
--- modules/struct/ChangeLog	2001/07/10 20:39:47	1.14
+++ modules/struct/ChangeLog	2001/09/05 23:32:36
@@ -1,3 +1,15 @@
+2001-09-05  Andreas Kupries  <andreas_kupries@users.sourceforge.net>
+
+	* The changes below fix bug [458011].
+
+	* tree.test (6.16): New test. Checks verificator of forbidden names.
+
+	* tree.tcl (::struct::tree::_insert): Added verification that node
+	  names do not contain forbidden characters.
+
+	* tree.n: Documented limitations on node names. Documented allowed
+	  index "end" for insert.
+
 2001-07-10  Andreas Kupries <andreas_kupries@users.sourceforge.net>
 
 	* matrix.tcl: Frink 2.2 run, fixed dubious code.
Index: modules/struct/tree.n
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/struct/tree.n,v
retrieving revision 1.11
diff -u -r1.11 tree.n
--- modules/struct/tree.n	2001/08/02 16:38:07	1.11
+++ modules/struct/tree.n	2001/09/05 23:32:36
@@ -75,7 +75,8 @@
 \fIparent\fR.  The nodes will be added in the order they are given.
 If \fIparent\fR is \fBroot\fR, it refers to the root of the tree.  The
 new nodes will be added to the \fIparent\fR node's child list at the
-index given by \fIindex\fR.
+index given by \fIindex\fR. The \fIindex\fR can be \fBend\fR in which
+case the new nodes will be added after the current last child.
 
 If any of the specified children already exist in \fItreeName\fR,
 those nodes will be moved from their original location to the new
@@ -83,7 +84,8 @@
 
 If no \fIchild\fR is specified, a single node will be added, and a
 name will be generated for the new node. The generated name is of the
-form \fBnode\fR\fIx\fR, where \fIx\fR is a number.
+form \fBnode\fR\fIx\fR, where \fIx\fR is a number. If names are
+specified they must neither contain whitespace nor colons (\fB:\fR).
 
 The return result from this command is a list of nodes added.
 .TP
Index: modules/struct/tree.tcl
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/struct/tree.tcl,v
retrieving revision 1.14
diff -u -r1.14 tree.tcl
--- modules/struct/tree.tcl	2001/06/22 15:29:18	1.14
+++ modules/struct/tree.tcl	2001/09/05 23:32:36
@@ -9,6 +9,8 @@
 # 
 # RCS: @(#) $Id: tree.tcl,v 1.14 2001/06/22 15:29:18 andreas_kupries Exp $
 
+package require Tcl 8.2
+
 namespace eval ::struct {}
 
 namespace eval ::struct::tree {
@@ -414,6 +416,13 @@
     if { [llength $args] == 0 } {
 	# No node name was given; generate a unique one
 	set args [list [__generateUniqueNodeName $name]]
+    } else {
+	# Validate the node names
+	foreach child $args {
+	    if {[regexp "\[\r\t\n :\]" $child]} {
+		return -code error "invalid node name \"$child\""
+	    }
+	}
     }
 
     if { ![_exists $name $parentNode] } {
Index: modules/struct/tree.test
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/struct/tree.test,v
retrieving revision 1.12
diff -u -r1.12 tree.test
--- modules/struct/tree.test	2000/06/16 20:15:32	1.12
+++ modules/struct/tree.test	2001/09/05 23:32:36
@@ -258,6 +258,12 @@
     mytree destroy
     set msg
 } "node \"node0\" cannot be its own descendant"
+test tree-6.16 {insert gives error for invalid node names} {
+    tree mytree
+    catch {mytree insert root end ":\n\t "} msg
+    mytree destroy
+    set msg
+} "invalid node name \":\n\t \""
 
 test tree-7.1 {move gives error when trying to move root} {
     tree mytree
@@ -587,16 +593,16 @@
 test tree-12.1.6 {pre dfs walk, nodes with spaces in names} {
     tree mytree
     set t [list ]
-    mytree insert root end "node 0"
-    mytree insert root end "node 1"
-    mytree insert "node 0" end "node 0 1"
-    mytree insert "node 0" end "node 0 2"
-    mytree insert "node 1" end "node 1 1"
-    mytree insert "node 1" end "node 1 2"
+    mytree insert root end "node/0"
+    mytree insert root end "node/1"
+    mytree insert "node/0" end "node/0/1"
+    mytree insert "node/0" end "node/0/2"
+    mytree insert "node/1" end "node/1/1"
+    mytree insert "node/1" end "node/1/2"
     mytree walk root -type dfs -command {lappend t %n}
     mytree destroy
     set t
-} [list root "node 0" "node 0 1" "node 0 2" "node 1" "node 1 1" "node 1 2"]
+} [list root "node/0" "node/0/1" "node/0/2" "node/1" "node/1/1" "node/1/2"]
 
 test tree-12.2 {pre bfs walk} {
     tree mytree
