Closed andrei-pavel closed 2 years ago
Trying to do a setItem and getting:
setItem
libyang[0]: Duplicate predicate key "identifier" in path. N7sysrepo13ErrorWithCodeE, what: Session::setItem: Couldn't set '/kea-dhcp6-server:config/shared-networks[name='my-secret-network']/subnet6[id='1']/reservations[identifier-type='duid'][identifier='01:02:03:04:05:06:07:08:09:0A']/duid' to '01:02:03:04:05:06:07:08:09:0A': SR_ERR_INVAL_ARG
I think identifier-type is compared with identifier and it determines that they are equal? The following line seems relevant.
identifier-type
identifier
if (!strncmp(set->objs[i], name, name_len) && !isalpha(((char *)set->objs[i])[name_len])) {
isalpha seems to try to determine if the string ends at that length? But in this case it matches the dash?
isalpha
Changing it to the following seems to fix the issue on my end, but causes libyang unit tests to fail.
if (name_len == strlen(set->objs[i]) && !strncmp(set->objs[i], name, name_len)) {
The following tests FAILED: 29 - utest_instanceid (Failed) 30 - utest_instanceid_valgrind (Failed) 77 - utest_tree_schema_compile (Failed) 78 - utest_tree_schema_compile_valgrind (Failed)
Using versions from master branches with C++ API, but reporting here because it seems to be a libyang issue.
LIBYANG_VERSION: 2.0.231 LIBYANGCPP_VERSION: 1.1.0 SYSREPO_VERSION: 2.1.84 SYSREPOCPP_VERSION: 1.1.0
Yes, the check should now be properly fixed.
Works on my end. Thank you!
Trying to do a
setItem
and getting:I think
identifier-type
is compared withidentifier
and it determines that they are equal? The following line seems relevant.isalpha
seems to try to determine if the string ends at that length? But in this case it matches the dash?Changing it to the following seems to fix the issue on my end, but causes libyang unit tests to fail.
Using versions from master branches with C++ API, but reporting here because it seems to be a libyang issue.