From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS40173 67.222.241.0/24 X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from smtp-out-2.mxes.net (smtp-out-2.mxes.net [67.222.241.249]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id D08681F428 for ; Fri, 15 Dec 2017 15:49:27 +0000 (UTC) Received: from battleground.jeremyevans.local (c-73-90-99-19.hsd1.ca.comcast.net [73.90.99.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id BA77027530; Fri, 15 Dec 2017 10:49:25 -0500 (EST) Received: from jeremyevans.local (speedstar.jeremyevans.local [10.187.8.2]) by battleground.jeremyevans.local (OpenSMTPD) with ESMTPS id dc11525a (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Fri, 15 Dec 2017 07:49:24 -0800 (PST) Date: Fri, 15 Dec 2017 07:49:23 -0800 From: Jeremy Evans To: Eric Wong Cc: kgio-public@bogomips.org Subject: Re: [PATCH] wait: avoid passing unnecessary args to rb_funcall Message-ID: <20171215154923.GU7579@jeremyevans.local> References: <20171215053434.GT7579@jeremyevans.local> <20171215063222.GA3233@dcvr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171215063222.GA3233@dcvr> User-Agent: Mutt/1.9.1 (2017-09-22) List-Id: On 12/15 06:32, Eric Wong wrote: > Jeremy Evans wrote: > > Example code: > > > > require 'socket' > > require 'kgio' > > addr = Socket.pack_sockaddr_in(80, 'www') > > socket = Kgio::Socket.connect(addr) > > buf = String.new(:capacity=>16384); nil > > socket.kgio_read!(16384, buf) > > > > Result on ruby 2.5: > > > > TypeError: can't convert FalseClass into time interval > > Odd, I haven't seen this; but using a fairly old gcc, though > (4.9.2-10 on Debian). I'm using clang 5.0.0 (current OpenBSD/amd64 default compiler). > > Cause: > > > > Misuse of rb_funcall. Not sure why ruby 2.5 is pickier than previous > > versions. > > Probably: > > r58362 ruby.h: check argc to rb_funcall > r59483 ruby.h: NULL as empty array > > ? > > Did you use the same compiler for previous Rubies? Yes. Older versions seem not have have problems, I regularly test 1.9.3-2.4. > > Noticed when testing unicorn with ruby 2.5. > > > > Fix: > > Looks good to me and I'll definitely accept it. > > However, it is worrying to have rb_funcall suddenly break... Agreed, but in this case it seems like we just got lucky it worked in earlier versions. I first noticed the error when testing with 2.5.0-preview1, but assumed it was a ruby regression that would be fixed before the final release. When it reoccured during testing of 2.5.0-rc1 is when I looked into the issue in more detail and found the cause. > Anyways, I'll credit you as the author; but wanted to make sure > you're alright with the proposed commit message: Yes, looks good to me. Thanks, Jeremy > > ------------8<------------ > From: Jeremy Evans > Subject: [PATCH] wait: avoid passing unnecessary args to rb_funcall > > The extra arg is unnecessary and causes errors on some systems > under Ruby 2.5.0dev. Note: this may be a regression in Ruby > 2.5.0dev itself and might need to be fixed upstream, as other > gems may also break. > > cf. https://bogomips.org/kgio-public/20171215053434.GT7579@jeremyevans.local/t/ > > Acked-by: Eric Wong > [ew: commit message] > --- > ext/kgio/wait.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/ext/kgio/wait.c b/ext/kgio/wait.c > index 7bdf0a1..fa2fb4a 100644 > --- a/ext/kgio/wait.c > +++ b/ext/kgio/wait.c > @@ -92,12 +92,12 @@ static VALUE kgio_wait_writable(int argc, VALUE *argv, VALUE self) > > VALUE kgio_call_wait_writable(VALUE io) > { > - return rb_funcall(io, id_wait_wr, 0, 0); > + return rb_funcall(io, id_wait_wr, 0); > } > > VALUE kgio_call_wait_readable(VALUE io) > { > - return rb_funcall(io, id_wait_rd, 0, 0); > + return rb_funcall(io, id_wait_rd, 0); > } > > void init_kgio_wait(void) > -- > EW