mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
528 stars 342 forks source link

pyang 2.6 crash in v_expand_2_augment() #882

Closed wlupton closed 5 months ago

wlupton commented 7 months ago

Just a quick note for now in case anyone (e.g., you @mbj4668!) immediately realises what the problem is.

I'm seeing this crash with pyang 2.6 (note that this is with the "od360" plugin, which enables some additional validation checks; it doesn't crash without the plugin):

% pyang --path=../types --path=../alarms --path=../sub-interfaces --path=../interfaces \
--path=../../../yang-external/ --max-line-length=70 --lint --lint-modulename-prefix=bbf \
--lint-namespace-prefix=urn:bbf:yang: --lint-ensure-hyphenated-name \
--plugindir ../../../install/python/od360 --od360  --format=tree \
bbf-l2-forwarding-flooding-policies.yang >docs/bbf-l2-forwarding-flooding-policies.tree
Traceback (most recent call last):
  File "/Users/william/Development/pyang/default/bin/pyang", line 9, in <module>
    sys.exit(run())
  File "/Users/william/Development/pyang/default/pyang/scripts/pyang_tool.py", line 438, in run
    ctx_validate_and_prune()
  File "/Users/william/Development/pyang/default/pyang/scripts/pyang_tool.py", line 434, in ctx_validate_and_prune
    ctx.validate()
  File "/Users/william/Development/pyang/default/pyang/context.py", line 348, in validate
    statements.validate_module(self, m)
  File "/Users/william/Development/pyang/default/pyang/statements.py", line 417, in validate_module
    iterate(module, phase)
  File "/Users/william/Development/pyang/default/pyang/statements.py", line 374, in iterate
    res = f(ctx, stmt)
  File "/Users/william/Development/pyang/default/pyang/statements.py", line 192, in <lambda>
    ('import', 'submodule'):lambda ctx, s: v_import_module(ctx, s),
  File "/Users/william/Development/pyang/default/pyang/statements.py", line 628, in v_import_module
    submodule = add_module(i, stmt.i_is_primary_module)
  File "/Users/william/Development/pyang/default/pyang/statements.py", line 613, in add_module
    validate_module(ctx, m)
  File "/Users/william/Development/pyang/default/pyang/statements.py", line 417, in validate_module
    iterate(module, phase)
  File "/Users/william/Development/pyang/default/pyang/statements.py", line 409, in iterate
    iterate(s, phase)
  File "/Users/william/Development/pyang/default/pyang/statements.py", line 374, in iterate
    res = f(ctx, stmt)
  File "/Users/william/Development/pyang/default/pyang/statements.py", line 219, in <lambda>
    ('expand_2', 'augment'):lambda ctx, s: v_expand_2_augment(ctx, s),
  File "/Users/william/Development/pyang/default/pyang/statements.py", line 1759, in v_expand_2_augment
    stmt.i_target_node = find_target_node(ctx, stmt, is_augment=True)
  File "/Users/william/Development/pyang/default/pyang/statements.py", line 2596, in find_target_node
    node = search_child(module.i_children, module.i_modulename, identifier)
AttributeError: 'ModSubmodStatement' object has no attribute 'i_children'
mbj4668 commented 7 months ago

No, I don't see immediately what the problem is... Can I run this myself?

wlupton commented 7 months ago

Thanks. Not easily! Let me try to create something simpler that shows the problem.

wlupton commented 6 months ago

I believe that this problem was fixed via 495dda0. @mbj4668 please can you confirm? Thanks.

mbj4668 commented 5 months ago

yes, this should be fixed now.