Skip to content

Commit 186ea37

Browse files
Humblesawmichalvasko
authored andcommitted
diff BUGFIX climb data tree parents to cross schema-mount boundary
In lyd_diff_dup(), the parent-climbing loop used lysc_data_parent() to find the next parent, which returns NULL at a schema mount boundary. This caused the diff to miss the host module's parent containers around mounted module data. Use the data tree parent (node_parent->parent) instead, which crosses the mount boundary correctly. Also stop climbing once the existing diff parent level is reached.
1 parent 3eb3f18 commit 186ea37

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/diff.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,9 @@ lyd_diff_dup(const struct lyd_node *node, enum lyd_diff_op op, struct lyd_node *
352352
dup_parent = *dup;
353353
node_parent = node;
354354
sparent = parent ? parent->schema : NULL;
355-
while (lysc_data_parent(dup_parent->schema) &&
356-
!lyd_compare_schema_equal(lysc_data_parent(dup_parent->schema), sparent, 0)) {
357-
node_parent = node_parent->parent;
358-
355+
while (node_parent->parent && (!sparent || !lyd_compare_schema_equal(node_parent->parent->schema, sparent, 0))) {
359356
/* duplicate the next parent */
357+
node_parent = node_parent->parent;
360358
LY_CHECK_RET(lyd_dup_single(node_parent, NULL, LYD_DUP_NO_META | LYD_DUP_WITH_FLAGS, &d));
361359

362360
/* connect the existing dup tree into the parent */

0 commit comments

Comments
 (0)