Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Container attributes are discarded on re-initialization #625
I'm not completely sure this is a bug, but it was certainly hard to figure out. If it's not a bug, it seems like it's well worth having a big fat warning somewhere on the documentation page.
Essentially it's this. Given the table below:
The entry added in some_other_event will never expire. The re-initialization of
It's just counterintuitive to me that re-initializing a variable in effect changes its type.
Demonstration code that can be run on try.zeek.org with ssh.pcap (for example) as background.
Even after looking at that other ticket, and reading the https://docs.zeek.org/en/stable/script-reference/attributes.html page again, I don't think I understand the issue well enough to give a great answer here. It appears that attributes are actually being applied to the initial value of the container rather than the variable holding the value?
Anyway, I think a good first step would be a warning on the Attributes page, just below the initial attribute list. Because if a developer finds that the attributes are not working as expected, the first thing they're likely to try is to go back and re-read the documentation looking for behavioral hints. Possibly also a cross-reference in the Types page where the affected types are described.