kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Jeremy Evans <code@jeremyevans.net>
To: Eric Wong <e@80x24.org>
Cc: kgio-public@bogomips.org
Subject: Re: [PATCH] wait: avoid passing unnecessary args to rb_funcall
Date: Fri, 15 Dec 2017 07:49:23 -0800	[thread overview]
Message-ID: <20171215154923.GU7579@jeremyevans.local> (raw)
In-Reply-To: <20171215063222.GA3233@dcvr>

On 12/15 06:32, Eric Wong wrote:
> Jeremy Evans <code@jeremyevans.net> 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 <code@jeremyevans.net>
> 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 <e@80x24.org>
> [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

      reply	other threads:[~2017-12-15 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-15  5:34 Fix error on ruby 2.5 Jeremy Evans
2017-12-15  6:32 ` [PATCH] wait: avoid passing unnecessary args to rb_funcall Eric Wong
2017-12-15 15:49   ` Jeremy Evans [this message]

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/kgio/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171215154923.GU7579@jeremyevans.local \
    --to=code@jeremyevans.net \
    --cc=e@80x24.org \
    --cc=kgio-public@bogomips.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/kgio.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).