zeek
zeek copied to clipboard
Incorrect handling of init expression on set of sets
I would expect the following code to either work at runtime or be outright rejected:
# foo.zeek
event zeek_init()
{
local vs: set[set[string]] = { [ set() ] };
assert |vs| == 1;
}
$ zeek -b foo.zeek
error in foo.zeek, line 4: assertion failure: sizeof vs == 1
fatal error: errors occurred while initializing
I originally saw this with an initialization of the form
local vs: set[count, set[string, bool]] = { [ 1, set() ] };
In a Slack discussion there was an argument that this should not be supported at all and rejected since values in a set should be immutable (which a set is not). I'd argue that the usage here which does not modify the contained values at all could still be supported; we could still reject mutating operations on vs at runtime.