Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse specifications involving nested messages #681

Closed
isaahzorgh opened this issue Jun 24, 2021 · 3 comments
Closed

Unable to parse specifications involving nested messages #681

isaahzorgh opened this issue Jun 24, 2021 · 3 comments
Labels

Comments

@isaahzorgh
Copy link

There is a bug in PyRFLX parsing specifications with Protocol::ascpect_of_protocol.
This bug happens while validating the TCP specification in https://github.com/Componolit/RecordFlux-specifications/tree/issue_27 but with the commented lines with the length restrictions uncommented.

@isaahzorgh isaahzorgh added the bug label Jun 24, 2021
@treiher treiher added the pyrflx Related to pyrflx package (Legacy Python API) label Jun 24, 2021
@treiher
Copy link
Collaborator

treiher commented Jun 24, 2021

Could you please provide a permanent link to the affected line of the specification file? What is the concrete error message?

@isaahzorgh
Copy link
Author

The line in the specification would be: https://github.com/Componolit/RecordFlux-specifications/blob/db9b5317da6f5d7934ae5cb84314154d50760ab7/tcp.rflx#L57
with the following line in the same style showing the same bug and error message.

This error message would be:

Traceback (most recent call last):
  File "validate_spec.py", line 414, in <module>
    sys.exit(cli(sys.argv))
  File "validate_spec.py", line 120, in cli
    args.target_coverage,
  File "validate_spec.py", line 161, in validate
    validation_result = _validate_message(path, is_valid_directory, message_value)
  File "validate_spec.py", line 195, in _validate_message
    parser_result.parse(original_message)
  File "/PATH/TO/RecordFlux-specifications/venv/lib/python3.7/site-packages/rflx/pyrflx/typevalue.py", line 793, in parse
    ) = set_field_with_size(current_field_name, current_field_size)
  File "/PATH/TO/RecordFlux-specifications/venv/lib/python3.7/site-packages/rflx/pyrflx/typevalue.py", line 772, in set_field_with_size
    value[current_pos_in_bitstring : current_pos_in_bitstring + field_size],
  File "/PATH/TO/RecordFlux-specifications/venv/lib/python3.7/site-packages/rflx/pyrflx/typevalue.py", line 872, in set
    field.typeval.parse(value)
  File "/PATH/TO/RecordFlux-specifications/venv/lib/python3.7/site-packages/rflx/pyrflx/typevalue.py", line 453, in parse
    nested_message.parse(value, check)
  File "/PATH/TO/RecordFlux-specifications/venv/lib/python3.7/site-packages/rflx/pyrflx/typevalue.py", line 778, in parse
    current_field = self._fields[current_field_name]
KeyError: ''```

@treiher
Copy link
Collaborator

treiher commented Jul 2, 2021

The expression in the referenced specification is invalid, as 'Size is missing on TCP::Shift_Cnt. So that is actually a bug in the message validation (#686).

@treiher treiher closed this as completed Jul 2, 2021
@treiher treiher added invalid and removed bug pyrflx Related to pyrflx package (Legacy Python API) labels Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants