[Bro-Dev] [JIRA] (BIT-1192) record initialization weirdness

Jon Siwek (JIRA) jira at bro-tracker.atlassian.net
Mon May 19 13:23:07 PDT 2014

    [ https://bro-tracker.atlassian.net/browse/BIT-1192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16603#comment-16603 ] 

Jon Siwek commented on BIT-1192:

The expression list given to a record ctor may currently be comprised of record-field-assignment expressions or any expressions that evaluate in to a record.  For all the expressions in the later case, their record fields will get incorporated in to the type of the outer record ctor.  Or at least that's what supposed to happen, except the code currently doesn't work if there's more than one such expression.

In light of that, I'm going to change record ctor's expression list to only allow record-field-assignments (which fixes the issue in this ticket).  No default scripts rely on the other functionality, which appears to be a relict, and I don't see the use of a record ctor that takes a single expression which evaluates in to a record (you can just use that expression instead of the ctor).

> record initialization weirdness
> -------------------------------
>                 Key: BIT-1192
>                 URL: https://bro-tracker.atlassian.net/browse/BIT-1192
>             Project: Bro Issue Tracker
>          Issue Type: Problem
>          Components: Bro
>    Affects Versions: git/master
>            Reporter: Justin Azoff
>            Priority: Low
>              Labels: language
>             Fix For: 2.3
> If you redundantly define a record as in cmd_bad:
> {code}
> event bro_init()
> {
>     local strcmd = "echo hi";
>     print "inline", [$cmd=strcmd];
>     local cmd_ok = Exec::Command($cmd=strcmd);
>     print "ok", cmd_ok;
>     local cmd_bad = Exec::Command([$cmd=strcmd]);
>     print "bad", cmd_bad;
> }
> {code}
> You get this:
> {code}
> inline, [cmd=echo hi]
> ok, [cmd=echo hi, stdin=, read_files=<uninitialized>, uid=BHMrHdIapni]
> bad, [cmd=[cmd=echo hi], stdin=, read_files=<uninitialized>, uid=NsfjD555BY1]
> {code}

This message was sent by Atlassian JIRA

More information about the bro-dev mailing list