[jruby-user] SystemCallError.new does not create Errno

0 views
Skip to first unread message

Justin Collins

unread,
Oct 7, 2009, 3:11:10 PM10/7/09
to us...@jruby.codehaus.org
SystemCallError.new is supposed to create a new instance of the
appropriate Errno class based on the errno given. However, there seems
to be some problem:

irb(main):001:0> Errno::EACCES.new.errno
=> 13
irb(main):002:0> SystemCallError.new 13
=> #<SystemCallError: Unknown error 13>

This is with jruby 1.4.0RC1 (ruby 1.8.7 patchlevel 174) (2009-09-30
80c263b) (OpenJDK Client VM 1.6.0_0) [i386-java]

Compare to MRI:

irb(main):001:0> Errno::EACCES.new.errno
=> 13
irb(main):002:0> SystemCallError.new 13
=> #<Errno::EACCES: Permission denied>


-Justin
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Charles Oliver Nutter

unread,
Oct 8, 2009, 4:43:21 PM10/8/09
to us...@jruby.codehaus.org
On Wed, Oct 7, 2009 at 1:11 PM, Justin Collins <li...@ruby-forum.com> wrote:
> SystemCallError.new is supposed to create a new instance of the
> appropriate Errno class based on the errno given. However, there seems
> to be some problem:
>
> irb(main):001:0> Errno::EACCES.new.errno
> => 13
> irb(main):002:0> SystemCallError.new 13
> => #<SystemCallError: Unknown error 13>

Yup, looks like our SystemCallError is only accepting strings. You
should file a bug, and see if there's a spec for this you can add to
Rubyspec (www.rubyspec.org).

- Charlie

Vladimir Sizikov

unread,
Oct 9, 2009, 6:49:56 AM10/9/09
to us...@jruby.codehaus.org
Hi Justin, Charlie,

On Thu, Oct 8, 2009 at 10:43 PM, Charles Oliver Nutter
<hea...@headius.com> wrote:
> On Wed, Oct 7, 2009 at 1:11 PM, Justin Collins <li...@ruby-forum.com> wrote:
>> SystemCallError.new is supposed to create a new instance of the
>> appropriate Errno class based on the errno given. However, there seems
>> to be some problem:
>>
>> irb(main):001:0> Errno::EACCES.new.errno
>> => 13
>> irb(main):002:0> SystemCallError.new 13
>> => #<SystemCallError: Unknown error 13>
>
> Yup, looks like our SystemCallError is only accepting strings. You
> should file a bug, and see if there's a spec for this you can add to
> Rubyspec (www.rubyspec.org).

Actually, SystemCallError does accept string and numeric values. What
it doesn't do it doesn't convert bare SystemCallError to proper Errno
when it should. I'll take a look and see what we can do here. I think
we have everything in place, including the platform-dependent
errno-values from Constantine project (which was a big problem in the
past), so we just need to wire this stuff up.

Justin, could you please file a JIRA issue for this, if you can?

Thanks,
--Vladimir

Vladimir Sizikov

unread,
Oct 9, 2009, 6:57:52 AM10/9/09
to us...@jruby.codehaus.org
> Justin, could you please file a JIRA issue for this, if you can?

Аh, sorry, you've already filed: http://jira.codehaus.org/browse/JRUBY-4071
Will fix.

Vladimir Sizikov

unread,
Oct 9, 2009, 9:27:44 AM10/9/09
to us...@jruby.codehaus.org
Hi Justin, folks,

On Wed, Oct 7, 2009 at 9:11 PM, Justin Collins <li...@ruby-forum.com> wrote:
> SystemCallError.new is supposed to create a new instance of the
> appropriate Errno class based on the errno given.

The issue has been fixed in 10e567b on master (1.5dev) branch.
Please take a look and verify. ;) Small Rubyspec test also has been added.

Thanks,
--Vladimir

Justin Collins

unread,
Oct 10, 2009, 11:23:20 PM10/10/09
to us...@jruby.codehaus.org
Vladimir Sizikov wrote:
> Hi Justin, folks,
>
> On Wed, Oct 7, 2009 at 9:11 PM, Justin Collins <li...@ruby-forum.com>
> wrote:
>> SystemCallError.new is supposed to create a new instance of the
>> appropriate Errno class based on the errno given.
>
> The issue has been fixed in 10e567b on master (1.5dev) branch.
> Please take a look and verify. ;) Small Rubyspec test also has been
> added.
>
> Thanks,
> --Vladimir

Looks like it is working to me. Thanks, now my lib passes all the tests
:)

-Justin
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages