From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS6939 64.71.128.0/18 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.clogger.general 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 Message-ID: <20120608224710.GA3307@dcvr.yhbt.net> References: <20120608224710.GA3307@dcvr.yhbt.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1339195644 10402 80.91.229.3 (8 Jun 2012 22:47:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Jun 2012 22:47:24 +0000 (UTC) To: clogger@librelist.org Original-X-From: clogger@librelist.org Sat Jun 09 00:47:23 2012 Return-path: Envelope-to: gcrcg-clogger@m.gmane.org In-Reply-To: <20120608224710.GA3307@dcvr.yhbt.net> List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Precedence: list Original-Sender: clogger@librelist.org Xref: news.gmane.org gmane.comp.lang.ruby.clogger.general:55 Archived-At: Received: from zedshaw.xen.prgmr.com ([64.71.167.205]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sd7xb-00076a-Qs for gcrcg-clogger@m.gmane.org; Sat, 09 Jun 2012 00:47:16 +0200 Received: from zedshaw.xen.prgmr.com (localhost [IPv6:::1]) by zedshaw.xen.prgmr.com (Postfix) with ESMTP id E709721DE08 for ; Fri, 8 Jun 2012 22:55:20 +0000 (UTC) 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 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