mdsplus icon indicating copy to clipboard operation
mdsplus copied to clipboard

old-trees branch only: -- inconsistent max node name length

Open mwinkel-cfs opened this issue 2 years ago • 3 comments

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.

old_trees_char64_bug

mwinkel-cfs avatar Jul 01 '22 20:07 mwinkel-cfs

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];

mwinkel-cfs avatar Jul 01 '22 20:07 mwinkel-cfs

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.

mwinkel-cfs avatar Jul 02 '22 21:07 mwinkel-cfs

Yeah, likely off-by-one. The length should be 63 (plus the null terminator), so anywhere that tells the user 64 should be updated.

WhoBrokeTheBuild avatar Jul 07 '22 17:07 WhoBrokeTheBuild

The same issue occurs when attempting to rename a node to something longer than 63 characters.

mwinkel-dev avatar Jan 13 '23 02:01 mwinkel-dev

Associated PR #2522 was closed, so closing this Issue.

mwinkel-dev avatar May 08 '23 21:05 mwinkel-dev