rb_sys_fail problem with One Click Installer

D

djberg96

Hi all,

Ruby 1.8.2 RC 7 and 10
Win2k and WinXP Pro
VC++ 6.0 and 7.0

I've posted this as a bug on RubyForge, but I thought maybe some folks
here could help me.

I've got a C extension (win32-process) where I define my own
Process.kill method (for a couple reasons). In it, I use
rb_sys_fail(0). The problem is that it's causing a segfault:

# Sample script
require "win32/process"
Process.kill(0,99999) # Should raise Errno::ENOENT

Result:

C:\eclipse\workspace\win32-process>ruby ktest.rb
ktest.rb:10: [BUG] rb_sys_fail() - errno == 0
ruby 1.8.2 (2004-11-06) [i386-mswin32]

This application has requested the Runtime to terminate it in an
unusual way.
Please contact the application's support team for more information.

The relevant function comes from error.c:

void
rb_sys_fail(mesg)
const char *mesg;
{
extern int errno;
int n = errno;
VALUE arg;

errno = 0;
if (n == 0) {
rb_bug("rb_sys_fail(%s) - errno == 0", mesg ? mesg : "");
}

arg = mesg ? rb_str_new2(mesg) : Qnil;
rb_exc_raise(rb_class_new_instance(1, &arg, get_syserr(n)));
}

A couple of notes. First, if I replace rb_sys_fail(0) with something
like rb_raise(rb_eStandardError,"...") it works fine. Second, I only
see this behavior when I use the One Click Installer. If I build from
scratch, it works fine.

I could work around this if there were a way to set errno manually
somehow within the extension.

Any ideas?

Regards,

Dan

PS - RubyForge bug is at
http://rubyforge.org/tracker/index.php?func=detail&aid=363&group_id=167&atid=715
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top