jls-grok 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/grok.gemspec +1 -1
  2. data/lib/grok.rb +12 -0
  3. data/lib/grok/match.rb +6 -0
  4. metadata +51 -67
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
 
39
39
  #svnrev = %x{svn info}.split("\n").grep(/Revision:/).first.split(" ").last.to_i
40
40
  spec.name = "jls-grok"
41
- spec.version = "0.4.3"
41
+ spec.version = "0.4.4"
42
42
 
43
43
  spec.summary = "grok bindings for ruby"
44
44
  spec.description = "Grok ruby bindings - pattern match/extraction tool"
@@ -94,6 +94,18 @@ class Grok < FFI::Struct
94
94
  rc = grok_execn(self, text_c, text.size, match)
95
95
  case rc
96
96
  when GROK_OK
97
+ # Give the Grok::Match object a reference to the 'text_c'
98
+ # object which is also Grok::Match#subject string;
99
+ # this will prevent Ruby from garbage collecting it until
100
+ # the match object is garbage collectd.
101
+ #
102
+ # If we don't do this, then 'text_c' will fall out of
103
+ # scope at the end of this function and become a candidate
104
+ # for garbage collection, causing Grok::Match#subject to become
105
+ # corrupt and any captures to point to those corrupt portions.
106
+ # http://code.google.com/p/logstash/issues/detail?id=47
107
+ match.subject_memorypointer = text_c
108
+
97
109
  return match
98
110
  when GROK_ERROR_NOMATCH
99
111
  return false
@@ -21,6 +21,12 @@ class Grok::Match < FFI::Struct
21
21
  :start, :int,
22
22
  :end, :int
23
23
 
24
+ # Placeholder for the FFI::MemoryPointer that we pass to
25
+ # grok_execn() during Grok#match; this should prevent ruby from
26
+ # garbage collecting us until the GrokMatch goes out of scope.
27
+ # http://code.google.com/p/logstash/issues/detail?id=47
28
+ attr_accessor :subject_memorypointer
29
+
24
30
  public
25
31
  def initialize
26
32
  super
metadata CHANGED
@@ -1,44 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jls-grok
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 3
10
- version: 0.4.3
5
+ version: 0.4.4
11
6
  platform: ruby
12
7
  authors:
13
- - Jordan Sissel
14
- - Pete Fritchman
8
+ - Jordan Sissel
9
+ - Pete Fritchman
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
13
 
19
- date: 2011-02-23 00:00:00 -08:00
14
+ date: 2011-03-03 00:00:00 -08:00
20
15
  default_executable:
21
16
  dependencies:
22
- - !ruby/object:Gem::Dependency
23
- name: ffi
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ~>
29
- - !ruby/object:Gem::Version
30
- hash: 1
31
- segments:
32
- - 0
33
- - 6
34
- - 3
35
- version: 0.6.3
36
- type: :runtime
37
- version_requirements: *id001
17
+ - !ruby/object:Gem::Dependency
18
+ name: ffi
19
+ prerelease: false
20
+ requirement: &id001 !ruby/object:Gem::Requirement
21
+ none: false
22
+ requirements:
23
+ - - ~>
24
+ - !ruby/object:Gem::Version
25
+ version: 0.6.3
26
+ type: :runtime
27
+ version_requirements: *id001
38
28
  description: Grok ruby bindings - pattern match/extraction tool
39
29
  email:
40
- - jls@semicomplete.com
41
- - petef@databits.net
30
+ - jls@semicomplete.com
31
+ - petef@databits.net
42
32
  executables: []
43
33
 
44
34
  extensions: []
@@ -46,32 +36,32 @@ extensions: []
46
36
  extra_rdoc_files: []
47
37
 
48
38
  files:
49
- - INSTALL
50
- - Rakefile
51
- - examples/grok-web.rb
52
- - examples/pattern-discovery.rb
53
- - examples/test.rb
54
- - grok.gemspec
55
- - lib/grok.rb
56
- - lib/grok/match.rb
57
- - lib/grok/pile.rb
58
- - test/Makefile
59
- - test/alltests.rb
60
- - test/general/basic_test.rb
61
- - test/general/captures_test.rb
62
- - test/patterns/day.rb
63
- - test/patterns/host.rb
64
- - test/patterns/ip.input
65
- - test/patterns/ip.rb
66
- - test/patterns/iso8601.rb
67
- - test/patterns/month.rb
68
- - test/patterns/number.rb
69
- - test/patterns/path.rb
70
- - test/patterns/prog.rb
71
- - test/patterns/quotedstring.rb
72
- - test/patterns/uri.rb
73
- - test/run.sh
74
- - test/speedtest.rb
39
+ - INSTALL
40
+ - Rakefile
41
+ - examples/grok-web.rb
42
+ - examples/pattern-discovery.rb
43
+ - examples/test.rb
44
+ - grok.gemspec
45
+ - lib/grok.rb
46
+ - lib/grok/match.rb
47
+ - lib/grok/pile.rb
48
+ - test/Makefile
49
+ - test/alltests.rb
50
+ - test/general/basic_test.rb
51
+ - test/general/captures_test.rb
52
+ - test/patterns/day.rb
53
+ - test/patterns/host.rb
54
+ - test/patterns/ip.input
55
+ - test/patterns/ip.rb
56
+ - test/patterns/iso8601.rb
57
+ - test/patterns/month.rb
58
+ - test/patterns/number.rb
59
+ - test/patterns/path.rb
60
+ - test/patterns/prog.rb
61
+ - test/patterns/quotedstring.rb
62
+ - test/patterns/uri.rb
63
+ - test/run.sh
64
+ - test/speedtest.rb
75
65
  has_rdoc: true
76
66
  homepage: http://code.google.com/p/semicomplete/wiki/Grok
77
67
  licenses: []
@@ -80,29 +70,23 @@ post_install_message:
80
70
  rdoc_options: []
81
71
 
82
72
  require_paths:
83
- - lib
73
+ - lib
84
74
  required_ruby_version: !ruby/object:Gem::Requirement
85
75
  none: false
86
76
  requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
93
80
  required_rubygems_version: !ruby/object:Gem::Requirement
94
81
  none: false
95
82
  requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- hash: 3
99
- segments:
100
- - 0
101
- version: "0"
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: "0"
102
86
  requirements: []
103
87
 
104
88
  rubyforge_project:
105
- rubygems_version: 1.5.1
89
+ rubygems_version: 1.5.0
106
90
  signing_key:
107
91
  specification_version: 3
108
92
  summary: grok bindings for ruby