Re: [Bro-Dev] consistency checking for attributes

2018-10-31 Thread Michał Purzyński
Yeah, error out and let there be no surprises.

On Wed, Oct 31, 2018 at 11:17 AM Vern Paxson  wrote:

> > To be honest I'm not even sure if the behavior
> > is defined right now, i.e. if the later value will overwrite the first
> one.
>
> I don't think it's defined.  Looking at the code, the later one will
> indeed overwrite the first one.
>
> > Do you want to error out when two  are found or overwrite the
> > first with the second one?
>
> My thinking is that listing them together should be an error.  I don't
> see why it would be legitimate for this to occur, and it seems like a
> mistake that could be made if there's a lengthy list of attributes.
>
> Vern
>
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


Re: [Bro-Dev] consistency checking for attributes

2018-10-31 Thread Vern Paxson
> To be honest I'm not even sure if the behavior
> is defined right now, i.e. if the later value will overwrite the first one.

I don't think it's defined.  Looking at the code, the later one will
indeed overwrite the first one.

> Do you want to error out when two  are found or overwrite the
> first with the second one?

My thinking is that listing them together should be an error.  I don't
see why it would be legitimate for this to occur, and it seems like a
mistake that could be made if there's a lengthy list of attributes.

Vern
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


Re: [Bro-Dev] consistency checking for attributes

2018-10-31 Thread Michał Purzyński
Sounds good and I like it. To be honest I'm not even sure if the behavior
is defined right now, i.e. if the later value will overwrite the first one.

Do you want to error out when two  are found or overwrite the
first with the second one?


On Mon, Oct 29, 2018 at 11:56 AM Vern Paxson  wrote:

> Attributes currently receive essentially no consistency checking.
> For example, executing this script:
>
> global a: count
>  = 10
>  = 9
> 
> 
> _func = function(d: double, t: time): count { return
> 3; };
> print a;
>
> simply results in:
>
> error in /Users/vern/tmp/attr-type-check.bro, line 7: value used but not
> set (a)
>
> I'm planning to add basic consistency checking, which will look for
> (1) attributes that are repeated (which doesn't appear to be meaningful for
> any of them) and (2) attributes that don't make sense in a given context,
> like the ones listed above.
>
> I'm thinking of implementing this as an internal table of meta-attributes,
> i.e., each attribute type, like ATTR_OPTIONAL, will have its own attributes
> like whether it requires a record context, only makes sense for aggregates,
> etc.  Here are the ones that come to mind, based on looking at the
> attributes
> at https://www.bro.org/sphinx/script-reference/attributes.html with
> examples
> in parens:
>
> applies to global variable  ()
> to global type  ()
> to event handler()
> to record field ()
> to indexed type ()
> to global indexed type  (_func)
> to type with expirable entries  (_func)
> to a file   (_interval)
>
> Any feedback?
>
> Vern
> ___
> bro-dev mailing list
> bro-dev@bro.org
> http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev
>
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


Re: [Bro-Dev] consistency checking for attributes

2018-10-31 Thread Robin Sommer
On Mon, Oct 29, 2018 at 11:49 -0700, Vern Paxson wrote:

> I'm planning to add basic consistency checking, which will look for
> (1) attributes that are repeated (which doesn't appear to be meaningful for
> any of them) and (2) attributes that don't make sense in a given context,
> like the ones listed above.

Sounds good to me.

Robin

-- 
Robin Sommer * Corelight, Inc. * ro...@corelight.com * www.corelight.com
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev