Commit graph

308 commits

Author SHA1 Message Date
Johanna Amann
7166cb7373 Merge remote-tracking branch 'origin/master' into topic/johanna/table-on-change 2020-01-31 10:06:52 -08:00
Jon Siwek
70b45d1aba Merge remote-tracking branch 'origin/topic/robin/631-deprecation-v2'
During merge I split the test for bro_init/bro_done/bro_script_loaded
event errors into individual tests since the other testing of the zeek
versions of those events seemed fine to otherwise keep.

* origin/topic/robin/631-deprecation-v2:
  Update NEWS for naming changes.
  Small cleanup and updating submodules.
  Remove test for legacy plugin.
  Remove legancy symlinks in aux/.
  Add warnings when loading scripts ending in ".bro", or using legacy environment variables.
  Fix missing rename.
  No longer symlink local.zeek to local.bro.
  Update notice user agent.
  Remove old_comm_usage_is_ok.
  Remove bro-config.h.in and bro-path-dev.in.
  Change Bro wrapper script to now abort when old executable names are still used.
  Remove APIs that were explicitly deprecated to be removed in 3.1.
2020-01-30 19:19:56 -08:00
Robin Sommer
d0b206fa36 Remove APIs that were explicitly deprecated to be removed in 3.1.
Special handling for bro_{init,done,script_loaded} events: if still
used, they cause Zeek to abort at startup.
2020-01-29 12:08:09 +00:00
Johanna Amann
382c4ddc2f &on_change: add insertion/change notifications.
Also - work with sets in addition to tables.
2020-01-13 19:39:40 -08:00
Jon Siwek
1f3ec434a8 Extend ASAN_OPTIONS in btests instead of overwrite 2020-01-08 21:04:18 -08:00
Jon Siwek
d581aa76aa Merge remote-tracking branch 'origin/topic/dev/patterns-in-sets'
Fixes in merge:
- Memory leak in HashKey ctor
- Minor whitespace/style changes

* origin/topic/dev/patterns-in-sets:
  Enable Patterns as Table index in non singleton cases
  Added support to create a Hashkey for PatternVals using their Pattern Texts
2020-01-06 14:15:30 -08:00
Jon Siwek
0fe2a14d98 Disable LeakSanitizer for btests that have known leaks
E.g. ones that throw interpreter exceptions,  as those are currently
known to potentially cause leaks.  Fixing the underlying leaks involves
the larger task of more IntrusivePtr usage.

Reference cycles may also cause leaks.
2020-01-02 12:05:49 -08:00
Jon Siwek
d917737766 Rewrite the btest for when-statement timeouts
To avoid a memory leak in DNS lookups that's hard to work around and
does not otherwise effect typical operation when Zeek is allowed to
continue to run after zeek_init().
2020-01-02 12:05:49 -08:00
Jon Siwek
0c71715cf4 Adjust btests for OpenBSD portability 2019-11-08 17:32:44 -08:00
Jon Siwek
b698c5507a GH-654: allow table() in function &default expressions
Table parameters of functions previously did not coerce unspecified
tables used in their &default attribute to the correct type.
2019-10-25 13:00:46 -07:00
Jon Siwek
34bf78984b GH-654: allow table() in record &default expressions
Table fields of records previously did not coerce unspecified tables
used in their &default attribute to the correct type.
2019-10-25 12:48:52 -07:00
Jon Siwek
4bf3c6ff22 Improve &default validation for global vars: exclude sets 2019-10-15 18:24:35 -07:00
Jon Siwek
42b6040952 Fix redef'ing a table with a new &default attribute 2019-10-11 18:57:03 -07:00
Jon Siwek
70359c703f Fix a test that used a hardcoded Broker port 2019-08-01 12:28:50 -07:00
Robin Sommer
13c373086d Merge remote-tracking branch 'origin/topic/zeke/closures' 2019-07-30 02:32:34 +00:00
Jon Siwek
70aa886806 Improve type inference for vector-of-enum constructor 2019-07-25 23:27:47 -07:00
Zeke Medley
e6464dae79 fix bug in serialization test 2019-07-25 11:53:16 -07:00
Zeke Medley
bdc8e0e6c4 Merge branch 'master' of https://github.com/zeek/zeek into topic/robin/closures-merge 2019-07-25 11:23:40 -07:00
Zeke Medley
cef94832f1 Frame merge and cleanup for merge. 2019-07-25 11:19:17 -07:00
Zeke Medley
0ca6b3e013 &expire_func(table, arg1, arg2, ...) + type checking. 2019-07-18 12:11:27 -07:00
Zeke Medley
1692be4c2d Fix bug in selective cloning. 2019-07-16 15:15:05 -07:00
Jon Siwek
db5b73cb8a Fix ref-counting bug in EnumType copy ctor
Which was used by the new ShallowClone method and causes multiple enum
declarations/definitions to now crash.  Such code is not typically
seen in scripts, but being able to define an enum in both .bif and
.bro files has historically been supported.
2019-07-15 12:42:56 -07:00
Zeke Medley
ef75092875 Use BROKER_PORT. 2019-07-12 16:00:12 -07:00
Zeke Medley
f0798c4b49 Allow serialization of closures over Broker.
anonymous-functions, their closures, can now be sent over broker.
In order to send an anonymous function the receiver must have parsed
a definition of the functon, but it need not to have been evaluated.
See testing/btest/language/closure-sending.zeek for an example of how
this can be done.

This also sends their closures as well as the closures of regular
functions.
2019-07-12 10:31:40 -07:00
Tim Wojtulewicz
ec4913ac18 GH-157: Mark some attributes as not allowed for global variables 2019-07-11 13:34:39 -07:00
Zeke Medley
6e84a5eb8e Merge branch 'master' of https://github.com/zeek/zeek into topic/zeke/closures 2019-07-01 13:43:48 -07:00
Zeke Medley
409f27955b Call parent constructor from LambdaExpr. 2019-07-01 13:36:28 -07:00
Jon Siwek
e9fefa6501 Remove deprecated print_hook event 2019-06-27 17:43:20 -07:00
Jon Siwek
bfd037989b Remove deprecated open_log_file and log_file_name functions 2019-06-27 17:43:20 -07:00
Zeke Medley
fef8aeb123 Merge branch 'master' of https://github.com/zeek/zeek into topic/zeke/closures 2019-06-27 14:39:08 -07:00
Zeke Medley
28253b24f9 Table defaults capture closures. 2019-06-27 14:38:38 -07:00
Zeke Medley
d7a73c270d Merge branch 'master' of https://github.com/zeek/zeek into topic/zeke/closures 2019-06-26 15:15:19 -07:00
Zeke Medley
8ed18ca194 Make ClosureFrame safe & cleanup
TODO: make anonymous-funcs associated with tables capture closures,
implement copy constructor for Frame, & other cleanup.
2019-06-26 15:05:57 -07:00
Johanna Amann
44b657687a Fix creating a StringVal from std::string.
Currently, creating a StringVal from a std::string did not work with
data that contains \0 characters. This easy fix changes this - and
should also lead to a small speed increase for code using this
constructor.

This obviously means that more data might copied now in some cases that
were previously cut off at the first 0-byte. Our test-suite did not
reveal any such cases.
2019-06-26 11:41:39 -07:00
Jon Siwek
f810de11fa Make a paraglob unit test parallelizable 2019-06-25 12:50:30 -07:00
Zeke Medley
670816ad48 Merge branch 'master' of https://github.com/zeek/zeek into topic/zeke/closures 2019-06-25 10:48:39 -07:00
Johanna Amann
31973f76ce Rename paraglob_get to paraglob_match
After going back to the original bug, I think this naming makes things a
bit more understandable.

GH-268
2019-06-24 15:44:21 -07:00
Johanna Amann
5f9a9bbcbe Merge branch 'paraglob' of https://github.com/ZekeMedley/zeek
* 'paraglob' of https://github.com/ZekeMedley/zeek:
  Add leak test to paraglob.
  Catch paraglob serialization errors in DoClone.
  Update paraglob serialization.
  Stop execution on paraglob error.
  Update paraglob submodule
  Change C++11 detection in paraglob.
  Make paraglob serializable and copyable.
  Initial paraglob integration.

I made a bunch of small changes:
 * paraglob now deals better with \0 characters
 * I rolled back the changes to Binary Serialization format,
 * there were some small formatting issue
 * the error output was slightly unsafe
 * build_unique is now in util.h.

and perhaps a few more small things.
2019-06-24 15:21:46 -07:00
Zeke Medley
6fd7d8c4d4 Sync with master for merge. 2019-06-24 09:40:43 -07:00
Zeke Medley
86741e7d06 Update tests to reflect new error msg. 2019-06-24 09:34:02 -07:00
Zeke Medley
f27209e84c Merge branch 'master' of https://github.com/zeek/zeek into topic/zeke/closures 2019-06-21 12:31:34 -07:00
Jon Siwek
16785a2d70 Merge remote-tracking branch 'origin/topic/timw/171-deprecation-warnings'
* origin/topic/timw/171-deprecation-warnings:
  GH-171: support warning messages alongside deprecated attributes

Made a minor tweak to give a better error message when using
&deprecated= with something other than a string literal expression.
2019-06-21 12:29:46 -07:00
Zeke Medley
8257a644d3 Lambdas selectively clone from the closure. 2019-06-21 12:02:41 -07:00
Zeke Medley
1ed672287b Merge branch 'master' of https://github.com/zeek/zeek into topic/zeke/closures 2019-06-21 09:41:41 -07:00
Tim Wojtulewicz
a5e03d25d4 GH-171: support warning messages alongside deprecated attributes 2019-06-20 22:57:15 -07:00
Johanna Amann
9564651655 Merge remote-tracking branch 'origin/master' 2019-06-20 20:25:05 -07:00
Zeke Medley
a3001f1b2b Add lambda expressions with closures to Zeek.
This allows anonymous functions in Zeek to capture their closures.
they do so by creating a copy of their enclosing frame and joining
that with their own frame.

There is no way to specify what specific items to capture from the
closure like C++, nor is there a nonlocal keyword like Python.
Attemptying to declare a local variable that has already been caught
by the closure will error nicely. At the worst this is an inconvenience
for people who are using lambdas which use the same variable names
as their closures.

As a result of functions copying their enclosing frames there is no
way for a function with a closure to reach back up and modify the
state of the frame that it was created in. This lets functions that
generate functions work as expected. The function can reach back and
modify its copy of the frame that it is captured in though.

Implementation wise this is done by creating two new subclasses in
Zeek. The first is a LambdaExpression which can be thought of as a
function generator. It gathers all of the ingredients for a function
at parse time, and then when evaluated creats a new version of that
function with the frame it is being evaluated in as a closure. The
second subclass is a ClosureFrame. This acts for most intents and
purposes like a regular Frame, but it routes lookups of values to its
closure as needed.
2019-06-20 18:43:56 -07:00
Jon Siwek
aefd9322fd Fix TableVal::DoClone to use CloneState cache 2019-06-20 18:34:36 -07:00
Johanna Amann
b1be8abe4e Merge remote-tracking branch 'remotes/origin/topic/robin/gh59-when'
Fixed a few small bugs - Modifiable had an uninitialized member and the
Registry looped over a map while deleting elements from it.

Fixes GH-319

* remotes/origin/topic/robin/gh59-when:
  Renaming src/StateAccess.{h,cc} to src/Notifier.{h,cc}.
  Clean up new code.
  Remove MutableVal class.
  Redo API for notifiers.
  Remove most of MutableVal (but not the class itelf yet)
  Remove enum Opcode.
  Remove StateAccess class.
  Redo NotfifierRegistry to no longer rely on StateAccess.
  Add new test for when-statement watching global variables.
  Couple of compile fixes.
2019-06-20 18:19:18 -07:00
Zeke Medley
a5f6757d7d Merge remote-tracking branch 'upstream/master' into paraglob 2019-06-20 14:14:48 -07:00