zeek / spicy

C++ parser generator for dissecting protocols & files.
https://docs.zeek.org/projects/spicy
Other
246 stars 35 forks source link

Fix spelling of stored Spicy hook priorities. #1728

Closed bbannier closed 4 months ago

bbannier commented 4 months ago

While in Spicy code hook priorities are spelled priority in HILTI code and also in our handling of its AST the corresponding attribute is still called &priority. We also do not perform any translation of "Spicy attributes" to "HILTI attributes", so us using priority as attribute name for Spicy lead to Spicy priorities being ignored. This seems to have been broken since at least 2020.

This patch fixes Spicy AST generation to emit attributes named &priority instead of the previous priority to be consistent with the HILTI handling. We also add a test validating that Spicy hook priorities are handled correctly.

bbannier commented 4 months ago

I made another pass over this. It seems that this wasn't a bug after all, just an API which could be easily misused, see e.g., https://github.com/zeek/zeek/pull/3699. All this should be helped by using the same attribute name in Spicy and HILTI. I removed the new test since we already had a test which showed that Spicy hook priorities worked correctly.