-
Notifications
You must be signed in to change notification settings - Fork 37
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
&convert usage makes self.field unavailable within field's %done hook #1661
Comments
The issue here seems to be that the parsing with |
Just to make sure this didn't go under, there's no issue if I remove the
|
Yep, that's the normal assignment of the value after parsing is done. We might need to trigger also trigger that whenever a chunk is processed since we allow users to run hooks at that point. |
There are actually more things wrong with chunked parsing. After a field is done parsing in addition to potentially setting the unit field we currently also update offsets, spicy/spicy/toolchain/src/compiler/codegen/parser-builder.cc Lines 733 to 834 in daa2e3c
module Test;
public type X = unit {
xs: bytes &eod &chunked {
print self.offset();
}
}; # Use incremental feeding so we get multiple chunks.
$ printf "\x80\x11\x22\x33\x44\x55\x66" | spicy-driver -d foo.spicy -i 1
0
0
0
0
0
0
0 I was hoping to call that code after parsing of a chunk is done, but unfortunately we don't seem to have direct access to it from there,
|
I think we should make '$$' work here and let it refer to the current chunk of bytes, and then generally interpret attributes on a |
Yes,
|
+1
No, it would be the current |
@rsmmr |
That's my point: I don't think it should refer to the converted value inside a |
The use-case was per byte xor decoding. But yes, I see now and agree with the proposed exclusion. Even pondering a bit if
|
Sounds like conclusion here is to remove support for the combination of |
…ert' * origin/topic/robin/gh-1661-chunked-convert: Deprecate usage of `&convert` with `&chunked`.
A minimal reproducer:
If one removes the
&convert
attribute onxs
, The currentself.xs
value becomes available within the%done
hook of the field. Seems&convert
shouldn't have this effect and instead ensure the "converted" value is available inself.xs
.This came up in Slack.
I'm looking at raising an event whenever one "chunk" of a
&chunked
field was consumed (thinkhttp_entity_data
style event).In the
.evt
file I'd like to use:And in the grammar, chunk is roughly the following.
When using
self.chunk
in the.evt
file, a violation is triggered:A workaround is to assign
self.chunk
to$$
within the inline%done
hook beforezeek::protocol_data_in()
.The text was updated successfully, but these errors were encountered: