* Fix error on ruby 2.5
@ 2017-12-15 5:34 Jeremy Evans
2017-12-15 6:32 ` [PATCH] wait: avoid passing unnecessary args to rb_funcall Eric Wong
0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Evans @ 2017-12-15 5:34 UTC (permalink / raw)
To: kgio-public
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
Cause:
Misuse of rb_funcall. Not sure why ruby 2.5 is pickier than previous
versions.
Noticed when testing unicorn with ruby 2.5.
Fix:
--- ext/kgio/wait.c.orig
+++ ext/kgio/wait.c
@@ -92,12 +92,12 @@ static VALUE kgio_wait_writable(int argc, VALUE *argv,
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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] wait: avoid passing unnecessary args to rb_funcall
2017-12-15 5:34 Fix error on ruby 2.5 Jeremy Evans
@ 2017-12-15 6:32 ` Eric Wong
2017-12-15 15:49 ` Jeremy Evans
0 siblings, 1 reply; 3+ messages in thread
From: Eric Wong @ 2017-12-15 6:32 UTC (permalink / raw)
To: Jeremy Evans; +Cc: kgio-public
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).
> 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?
> 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...
Anyways, I'll credit you as the author; but wanted to make sure
you're alright with the proposed commit message:
------------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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] wait: avoid passing unnecessary args to rb_funcall
2017-12-15 6:32 ` [PATCH] wait: avoid passing unnecessary args to rb_funcall Eric Wong
@ 2017-12-15 15:49 ` Jeremy Evans
0 siblings, 0 replies; 3+ messages in thread
From: Jeremy Evans @ 2017-12-15 15:49 UTC (permalink / raw)
To: Eric Wong; +Cc: kgio-public
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-15 15:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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).