From: Eric Wong <normalperson@yhbt.net>
To: clogger@librelist.org
Subject: Ruby 1.9.2 (and 1.9.1) bug (doesn't affect 1.9.3)
Date: Fri, 8 Jun 2012 15:47:10 -0700 [thread overview]
Message-ID: <20120608224710.GA3307@dcvr.yhbt.net> (raw)
In-Reply-To: <20120608224710.GA3307@dcvr.yhbt.net>
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
parent reply other threads:[~2012-06-08 22:47 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20120608224710.GA3307@dcvr.yhbt.net>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/clogger/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120608224710.GA3307@dcvr.yhbt.net \
--to=normalperson@yhbt.net \
--cc=clogger@librelist.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).