# bad record initializer (between Bro 2.3 and 2.4)

**URL:** <https://community.zeek.org/t/bad-record-initializer-between-bro-2-3-and-2-4/4483>\
**Category:** Zeek\
**Created:** [November 13, 2016, 9:54pm UTC](https://community.zeek.org/t/bad-record-initializer-between-bro-2-3-and-2-4/4483 "2016-11-13T21:54:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dopheide](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@dopheide](https://community.zeek.org/u/dopheide)\
**Post date:** [November 13, 2016, 9:54pm UTC](https://community.zeek.org/t/bad-record-initializer-between-bro-2-3-and-2-4/4483/1 "2016-11-13T21:54:45Z")

</div>

I’ve isolated the problem to using an ‘int’ in a record type as seen below. According to [try.bro.org](http://try.bro.org) the it started to fail between versions 2.3 and 2.4. If you change the boothnum to a string and put quotes around it, everything is fine.

Was there a syntax change that requires something around the int when it’s initialized?

-Dop

@load base/frameworks/input  
@load base/frameworks/notice

# add some stuff to generate notices from our test traffic:

@load misc/scan  
@load misc/detect-traceroute  
@load protocols/ssh/detect-bruteforcing

module Conn;

export {

type vlandata: record {  
booth: string &log &optional;  
boothnum: int &log &optional;  
};

global vlanlist: table[int] of vlandata = table() &redef;

}

redef vlanlist += {  
[11] = [$booth=“darkspace”],  
[18] = [$booth=“ASDF”,$boothnum=1743]  
};

---

<div class="post-metadata">

**Author:** ![Azoff\_Justin\_S](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Azoff\_Justin\_S](https://community.zeek.org/u/Azoff_Justin_S)\
**Post date:** [November 14, 2016, 2:27pm UTC](https://community.zeek.org/t/bad-record-initializer-between-bro-2-3-and-2-4/4483/2 "2016-11-14T14:27:03Z")

</div>

Does it work if you use 'count' instead of 'int' ?

---

<div class="post-metadata">

**Author:** ![dopheide](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@dopheide](https://community.zeek.org/u/dopheide)\
**Post date:** [November 14, 2016, 4:30pm UTC](https://community.zeek.org/t/bad-record-initializer-between-bro-2-3-and-2-4/4483/3 "2016-11-14T16:30:26Z")

</div>

_sigh_

That works, and int works if I prepend a + to the number.

Thanks,

Dop

---

<div class="post-metadata">

**Author:** ![Seth\_Hall3](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@Seth\_Hall3](https://community.zeek.org/u/Seth_Hall3)\
**Post date:** [November 14, 2016, 9:08pm UTC](https://community.zeek.org/t/bad-record-initializer-between-bro-2-3-and-2-4/4483/4 "2016-11-14T21:08:05Z")

</div>

That makes sense. The typecasting has some trouble promoting numbers assigned that way sometimes. If you create a minimal test case that fails in a way that you think it should work, it would help to have a ticket filed.

Thanks!  
&nbsp;&nbsp;.Seth

---

<div class="post-metadata">

**Author:** ![Daniel\_Thayer](https://avatars.discourse-cdn.com/v4/letter/d/8dc957/32.png) [@Daniel\_Thayer](https://community.zeek.org/u/Daniel_Thayer)\
**Post date:** [November 14, 2016, 10:19pm UTC](https://community.zeek.org/t/bad-record-initializer-between-bro-2-3-and-2-4/4483/5 "2016-11-14T22:19:54Z")

</div>

Here is a minimal test that works, but if you remove the "+" sign, then it fails:

type myrecord: record {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ii: int;  
};

# The "+" sign is required here:  
global rr1 = myrecord($ii = +3);

# But "+" is not required here:  
global rr2: myrecord;  
rr2$ii = 3;

print rr1;  
print rr2;

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:44pm UTC](https://community.zeek.org/t/bad-record-initializer-between-bro-2-3-and-2-4/4483/6 "2022-05-06T15:44:16Z")

</div>


