memcached 0.17.3 → 0.17.4

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ v0.17.4. Don't segfault on invalid keys in get_multi.
3
+
2
4
  v0.17.3. Compile with -Os. Retry once on Memcached::ClientError.
3
5
 
4
6
  v0.17.2. Fix realloc bug on Linux that got regressed.
@@ -1,30 +1,26 @@
1
1
  require 'mkmf'
2
+ require 'rbconfig'
2
3
 
3
4
  HERE = File.expand_path(File.dirname(__FILE__))
4
5
  BUNDLE = Dir.glob("libmemcached-*.tar.gz").first
5
6
  BUNDLE_PATH = BUNDLE.sub(".tar.gz", "")
6
7
 
7
- DARWIN = `uname -sp` == "Darwin i386\n"
8
-
9
- # is there a better way to do this?
10
- archflags = if ENV['ARCHFLAGS']
11
- ENV['ARCHFLAGS']
12
- elsif Config::CONFIG['host_os'] =~ /darwin10\.0\.*/
13
- "-arch i386 -arch x86_64"
14
- elsif Config::CONFIG['host_os'] =~ /darwin/
15
- "-arch i386 -arch ppc"
16
- else
17
- archflags = ''
8
+ if ENV['DEBUG']
9
+ puts "Setting debug flags."
10
+ $CFLAGS << " -O0 -ggdb -DHAVE_DEBUG"
11
+ $EXTRA_CONF = " --enable-debug"
18
12
  end
19
13
 
14
+ $CFLAGS = "#{RbConfig::CONFIG['CFLAGS']} #{$CFLAGS}".split(" ").uniq.join(" ").gsub("$(cflags)", "")
15
+ $LDFLAGS = "#{RbConfig::CONFIG['LDFLAGS']} #{$LDFLAGS}".split(" ").uniq.join(" ").gsub("$(ldflags)", "")
16
+ $CXXFLAGS = " -std=gnu++98"
17
+ $CPPFLAGS = $ARCH_FLAG = $DLDFLAGS = ""
18
+
20
19
  if !ENV["EXTERNAL_LIB"]
21
20
  $includes = " -I#{HERE}/include"
22
21
  $libraries = " -L#{HERE}/lib"
23
-
24
22
  $CFLAGS = "#{$includes} #{$libraries} #{$CFLAGS}"
25
23
  $LDFLAGS = "#{$libraries} #{$LDFLAGS}"
26
- $CPPFLAGS = $ARCH_FLAG = $DLDFLAGS = ""
27
-
28
24
  $LIBPATH = ["#{HERE}/lib"]
29
25
  $DEFLIBPATH = []
30
26
 
@@ -40,38 +36,17 @@ if !ENV["EXTERNAL_LIB"]
40
36
  puts(cmd = "patch -p1 < libmemcached.patch")
41
37
  raise "'#{cmd}' failed" unless system(cmd)
42
38
 
43
- Dir.chdir(BUNDLE_PATH) do
44
-
45
- cxxflags = cflags = ldflags = "-fPIC"
46
- extraconf = ''
47
-
48
- # again... is there a better way to do this?
49
- if DARWIN
50
- cflags = "#{cflags} #{archflags}"
51
- cxxflags = "-std=gnu++98 #{cflags}"
52
- ldflags = "#{ldflags} #{archflags}"
53
- extraconf = '--enable-dtrace --disable-dependency-tracking'
54
- end
55
-
56
- if ENV['DEBUG']
57
- puts "Setting debug flags for libmemcached."
58
- cflags << " -O0 -ggdb -DHAVE_DEBUG"
59
- extraconf << " --enable-debug"
60
- else
61
- cflags << " -Os"
62
- end
39
+ Dir.chdir(BUNDLE_PATH) do
40
+ puts(cmd = "env CFLAGS='-fPIC #{$CFLAGS}' LDFLAGS='-fPIC #{$LDFLAGS}' ./configure --prefix=#{HERE} --without-memcached --disable-shared --disable-utils #{$EXTRA_CONF} 2>&1")
63
41
 
64
- puts(cmd = "env CFLAGS='#{cflags}' LDFLAGS='#{ldflags}' ./configure --prefix=#{HERE} --without-memcached --disable-shared --disable-utils #{extraconf} 2>&1")
65
42
  raise "'#{cmd}' failed" unless system(cmd)
66
- puts(cmd = "make CXXFLAGS='#{cxxflags}' || true 2>&1")
43
+ puts(cmd = "make CXXFLAGS=#{$CXXFLAGS} || true 2>&1")
67
44
  raise "'#{cmd}' failed" unless system(cmd)
68
45
  puts(cmd = "make install || true 2>&1")
69
46
  raise "'#{cmd}' failed" unless system(cmd)
70
47
  end
71
48
 
72
- unless ENV['DEBUG'] or ENV['DEV']
73
- system("rm -rf #{BUNDLE_PATH}")
74
- end
49
+ system("rm -rf #{BUNDLE_PATH}") unless ENV['DEBUG'] or ENV['DEV']
75
50
  end
76
51
  end
77
52
 
@@ -83,22 +58,6 @@ if !ENV["EXTERNAL_LIB"]
83
58
  $LIBS << " -lmemcached_gem"
84
59
  end
85
60
 
86
- $CFLAGS.gsub! /-O\d/, ''
87
-
88
- if ENV['DEBUG']
89
- puts "Setting debug flags for gem."
90
- $CFLAGS << " -O0 -ggdb -DHAVE_DEBUG"
91
- else
92
- $CFLAGS << " -Os"
93
- end
94
-
95
- if DARWIN
96
- $CFLAGS.gsub! /-arch \S+/, ''
97
- $CFLAGS << " #{archflags}"
98
- $LDFLAGS.gsub! /-arch \S+/, ''
99
- $LDFLAGS << " #{archflags}"
100
- end
101
-
102
61
  if ENV['SWIG']
103
62
  puts "Running SWIG."
104
63
  puts(cmd = "swig #{$includes} -ruby -autorename rlibmemcached.i")
@@ -34,6 +34,7 @@
34
34
  $2 = (size_t *) malloc(($3+1)*sizeof(size_t));
35
35
  $1 = (char **) malloc(($3+1)*sizeof(char *));
36
36
  for(i = 0; i < $3; i ++) {
37
+ Check_Type(RARRAY_PTR($input)[i], T_STRING);
37
38
  $2[i] = RSTRING_LEN(RARRAY_PTR($input)[i]);
38
39
  $1[i] = StringValuePtr(RARRAY_PTR($input)[i]);
39
40
  }
@@ -45,6 +46,7 @@
45
46
  $2 = (size_t *) malloc(($3+1)*sizeof(size_t));
46
47
  $1 = (char **) malloc(($3+1)*sizeof(char *));
47
48
  for(i = 0; i < $3; i ++) {
49
+ Check_Type(RARRAY_PTR($input)[i], T_STRING);
48
50
  $2[i] = RSTRING_LEN(RARRAY_PTR($input)[i]);
49
51
  $1[i] = StringValuePtr(RARRAY_PTR($input)[i]);
50
52
  }
@@ -8629,6 +8629,7 @@ _wrap_memcached_mget(int argc, VALUE *argv, VALUE self) {
8629
8629
  arg3 = (size_t *) malloc((arg4+1)*sizeof(size_t));
8630
8630
  arg2 = (char **) malloc((arg4+1)*sizeof(char *));
8631
8631
  for(i = 0; i < arg4; i ++) {
8632
+ Check_Type(RARRAY_PTR(argv[1])[i], T_STRING);
8632
8633
  arg3[i] = RSTRING_LEN(RARRAY_PTR(argv[1])[i]);
8633
8634
  arg2[i] = StringValuePtr(RARRAY_PTR(argv[1])[i]);
8634
8635
  }
@@ -8746,6 +8747,7 @@ _wrap_memcached_mget_by_key(int argc, VALUE *argv, VALUE self) {
8746
8747
  arg5 = (size_t *) malloc((arg6+1)*sizeof(size_t));
8747
8748
  arg4 = (char **) malloc((arg6+1)*sizeof(char *));
8748
8749
  for(i = 0; i < arg6; i ++) {
8750
+ Check_Type(RARRAY_PTR(argv[3])[i], T_STRING);
8749
8751
  arg5[i] = RSTRING_LEN(RARRAY_PTR(argv[3])[i]);
8750
8752
  arg4[i] = StringValuePtr(RARRAY_PTR(argv[3])[i]);
8751
8753
  }
@@ -409,6 +409,10 @@ Please note that when pipelining is enabled, setter and deleter methods do not r
409
409
 
410
410
  Lib.memcached_stat_free(@struct, stat_struct)
411
411
  stats
412
+ rescue Memcached::SomeErrorsWereReported => _
413
+ e = _.class.new("Error getting stats")
414
+ e.set_backtrace(_.backtrace)
415
+ raise e
412
416
  end
413
417
 
414
418
  ### Operations helpers
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{memcached}
5
- s.version = "0.17.3"
5
+ s.version = "0.17.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Evan Weaver"]
9
9
  s.cert_chain = ["/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-public_cert.pem"]
10
- s.date = %q{2009-09-30}
10
+ s.date = %q{2009-11-18}
11
11
  s.description = %q{An interface to the libmemcached C client.}
12
12
  s.email = %q{}
13
13
  s.extensions = ["ext/extconf.rb"]
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Memcached", "--main", "README"]
18
18
  s.require_paths = ["lib", "ext"]
19
19
  s.rubyforge_project = %q{fauna}
20
- s.rubygems_version = %q{1.3.4}
20
+ s.rubygems_version = %q{1.3.5}
21
21
  s.signing_key = %q{/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-private_key.pem}
22
22
  s.summary = %q{An interface to the libmemcached C client.}
23
23
  s.test_files = ["test/test_helper.rb", "test/unit/binding_test.rb", "test/unit/memcached_test.rb", "test/unit/rails_test.rb"]
@@ -358,6 +358,12 @@ class MemcachedTest < Test::Unit::TestCase
358
358
  )
359
359
  end
360
360
 
361
+ def test_get_multi_checks_types
362
+ assert_raises(TypeError, ArgumentError) do
363
+ @cache.get([nil])
364
+ end
365
+ end
366
+
361
367
  def test_set_and_get_unmarshalled
362
368
  @cache.set key, @value
363
369
  result = @cache.get key, false
@@ -740,6 +746,11 @@ class MemcachedTest < Test::Unit::TestCase
740
746
  assert_instance_of String, stats[:version].first
741
747
  end
742
748
 
749
+ def test_missing_stats
750
+ cache = Memcached.new('localhost:43041')
751
+ assert_raises(Memcached::SomeErrorsWereReported) { cache.stats }
752
+ end
753
+
743
754
  # Clone
744
755
 
745
756
  def test_clone
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memcached
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.3
4
+ version: 0.17.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Weaver
@@ -30,7 +30,7 @@ cert_chain:
30
30
  yZ0=
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-09-30 00:00:00 -07:00
33
+ date: 2009-11-18 00:00:00 -08:00
34
34
  default_executable:
35
35
  dependencies: []
36
36
 
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  requirements: []
111
111
 
112
112
  rubyforge_project: fauna
113
- rubygems_version: 1.3.4
113
+ rubygems_version: 1.3.5
114
114
  signing_key:
115
115
  specification_version: 3
116
116
  summary: An interface to the libmemcached C client.
metadata.gz.sig CHANGED
Binary file