Segmentation fault with opaq leaf
Closed this issue · 2 comments
TribuneX commented
I am trying to implement a NETCONF remove operation similar to CESNET/libyang#1726.
I tried using new_path
with the paramerter opt_opaq
. However, while trying to find the leaf afterwards, I end up with a segmentation fault. See the following minimal example:
YANG_DIR = os.path.join(os.path.dirname(__file__), "yang")
def test_opaq_node():
ctx = Context(YANG_DIR, yanglib_path=YANG_DIR + "/yang-library.json")
ctx.load_module("yolo-system")
JSON_CONFIG = """{
"yolo-system:conf": {
}
}
"""
dnode = ctx.parse_data_mem(JSON_CONFIG, fmt='json', no_state=True)
dnode.new_path('/yolo-system:conf/hostname', value="", opt_opaq=True)
node = dnode.find_one('/yolo-system:conf/hostname') # crashes due to a segmentation fault
node.new_meta('ietf-netconf:operation', 'remove')
This issues is not limited to find_one
, since also iterating over such a tree results in the same error:
for node in dnode.iter_tree(): # also crashes.
pass
TribuneX commented
Any tipps on how to best track the cause of this issue to possibly provide a PR?
nvxf commented
We were able to identify the root issue and will submit a pull request.