* Ruby 1.9.2 (and 1.9.1) bug (doesn't affect 1.9.3)
@ 2012-06-08 22:47 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2012-06-08 22:47 UTC (permalink / raw)
To: clogger
I've just pushed this out to master of git://bogomips.org/clogger
Now can somebody find the commit in Ruby 1.9.3 that fixes this issue?
And perhaps file a backport ticket in case there's another 1.9.2
release.
Also, I'd appreciate a patch to replace rb_block_call() with
rb_iterate(), but needs to work under 1.8.7, 1.9.{2,3} and Rubinius.
(I unfortunately need to support some folks on 1.8.7, still :<)
>From e1bed92891f7db5c2d24040778fe31f76d723efe Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Fri, 8 Jun 2012 15:37:38 -0700
Subject: [PATCH] test case to simulate Rack::BodyProxy usage pattern
The use of Rack::BodyProxy#method_missing causes failures
under mainline Ruby 1.9.2 and 1.9.1, but not 1.9.3. This
test case exists to document this (now-fixed) bug for users
stuck on older Rubies.
On a side note, our usage of rb_iterate() should be rewritten
to use rb_block_call() as rb_iterate() is deprecated in 1.9.
A Ruby 1.9.2-p290 user privately reported this issue.
---
test/test_clogger.rb | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/test/test_clogger.rb b/test/test_clogger.rb
index 14613e0..10c587a 100644
--- a/test/test_clogger.rb
+++ b/test/test_clogger.rb
@@ -481,6 +481,26 @@ class TestClogger < Test::Unit::TestCase
assert r.object_id != body.object_id
end
+ # Rack::BodyProxy does this thing with method_missing
+ # This test fails under MRI 1.9.1 and 1.9.2, but works under 1.9.3
+ def test_each_with_external_block
+ foo = Object.new
+ foo.instance_variable_set(:@body, ["BodyProxy"])
+ def foo.method_missing(*args, &block)
+ @body.__send__(*args, &block)
+ end
+ app = lambda { |env| [302, [], foo] }
+ str = StringIO.new
+ cl = Clogger.new(app, :logger => str, :format => '$body_bytes_sent')
+ r = nil
+ assert_nothing_raised { r = cl.call(@req) }
+ body = []
+ r[2].each { |x| body << x }
+ r[2].close
+ assert_equal %w(BodyProxy), body
+ assert_equal "9\n", str.string
+ end
+
def test_http_09_request
str = StringIO.new
app = lambda { |env| [302, [ %w(a) ], []] }
--
Eric Wong
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2012-06-08 22:47 7% Ruby 1.9.2 (and 1.9.1) bug (doesn't affect 1.9.3) Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/clogger.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).