edit-config doesn't replace non-predicate value by value with predicate #2172
Labels
is:bug
Bug description.
status:completed
From the developer perspective, the issue was solved (bug fixed, question answered,...)
Hello!
I found possible issue in libyang source code (0e1e509 - last devel commit), which break edit-config replacement functionality for me.
I have the following part of ietf-nacm in datastore:
I want to change it in edit-config request by this:
My edit-config doesn't change value due instanceid comparison issue. The old value hasn't any predicates, but a new value contains one predicate ([if:name='eth1']).
I got the following stacktrace during accomplish edit-config:
Inside lyplg_type_compare_instanceid we have the following piece of code:
s1->predicates is NULL due old value hasn't predicates.
But code doesn't handle difference between old and new value in such case, and function return LY_SUCCESS instead of LY_ENOT. We just skip arrays length comparison due s1->predicates condition failed.
As i checked, LY_ARRAY_COUNT macro can handles NULL pointer, and return 0 in such case. So, it looks unnecessary to check s1->predicates != NULL.
So, my fix was:
After this old value was successfully replaced by a new one.
Please, check my suggestion, and if it's okay, i would like to create a PR in devel branch.
The text was updated successfully, but these errors were encountered: