[Bro-Dev] #395: Cannot add global to module if it already exists in global namespace
Bro Tracker
bro at tracker.icir.org
Fri Feb 11 15:32:25 PST 2011
#395: Cannot add global to module if it already exists in global namespace
---------------------+------------------------
Reporter: gregor | Owner:
Type: Problem | Status: new
Priority: Normal | Milestone: Bro1.6
Component: Bro | Version: git/master
Keywords: |
---------------------+------------------------
{{{
#!rst
The following policy snippet doesn't work::
global a = 1;
# the above can also be in a different file
module FOO;
export {
global a = 2;
}
I get the error: ``(a): error, already defined``
When I define the a's in a different order (module first, then global) it
works as expected.
From a quick glance it seems that the problem is that when bro parses the
``global`` in the module it searches all its scopes to check whether the
identifier already exists. I think this scanning of all scopes is
necessary to make redefs of globals in modules work (global xyz and redef
xyz are handled pretty much the same in ``parse.y``).
The problem also exists when trying to "overload" types (i.e., have type
xyz in the global scope and then try to redefine in in the module scope).
}}}
--
Ticket URL: <http://tracker.icir.org/bro/ticket/395>
Bro Tracker <http://tracker.icir.org/bro>
Bro Issue Tracker
More information about the bro-dev
mailing list