mdsplus
mdsplus copied to clipboard
old-trees branch only: -- inconsistent max node name length
Using the old-trees branch, create a new tree. Using TCL, attempt to add a 70 character node name. Dir command shows it was truncated to 63 characters. Now open the same tree in jTraverser -- it shows 64 characters. However jTraverser2 only shows 63 characters.
In the underlying data structures, is the node name a 65 character field (64 visible characters + 1 null terminator)? Or is it a 64 character field (63 visible characters + 1 null terminator)? Behavior demonstrated by this bug indicates inconsistent definition of the maximum node length.
Treeshrp.h defines a 64 character field (63 visible + 1 null terminator).
/********************************************
NODE
2) The second section of a tree file contains
nodes.
*********************************************/
#define MAX_NAME_LEN 63
typedef char NODE_NAME[MAX_NAME_LEN + 1];
typedef char TREE_NAME[MAX_NAME_LEN + 1];
/* note V1NODE_NAME does not have trailing \0 */
#define V1_MAX_NAME_LEN 12
typedef char V1NODE_NAME[V1_MAX_NAME_LEN];
The fact that jTraverser is displaying 64 characters, likely means that when treeshr adds a node it isn't correctly applying the null terminating character on the node name. This might be an off-by-one error.
Yeah, likely off-by-one. The length should be 63 (plus the null terminator), so anywhere that tells the user 64 should be updated.
The same issue occurs when attempting to rename a node to something longer than 63 characters.
Associated PR #2522 was closed, so closing this Issue.