Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
MRI silently handles .so files as Ruby sources
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Simone Carletti  
View profile  
 More options Mar 9 2011, 3:59 pm
From: Simone Carletti <wep...@weppos.net>
Date: Thu, 10 Mar 2011 05:59:30 +0900
Local: Wed, Mar 9 2011 3:59 pm
Subject: [ruby-core:35471] MRI silently handles .so files as Ruby sources

Hello,

today I noticed that if you have a file called filename.so.rb and you try to
require it without specifying the extension, MRI silently understands that
it isn't a .so file, will load the content and treat it as Ruby source.

# filename.so.rb

> puts __FILE__

> # somefile.rb
> require 'filename.so'

> # => /../../filename.so.rb

Other interpreters handle the case in a different way.
For example, JRuby won't load the file because it looks for a Ruby extension
in a file called filename.so.
See http://jira.codehaus.org/browse/JRUBY-5569

I had a small chat with Charles Oliver Nutter (you can read the comments in
the JIRA ticket) and I'm curious to know if the way MRI works should be
considered a bug, a coincidence or a feature.

Thanks,

--
Simone Carletti
Application Developer

Site & Blog: http://www.simonecarletti.com
Email: wep...@weppos.net
LinkedIn: http://linkedin.com/in/weppos
Skype: weppos


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charles Oliver Nutter  
View profile  
 More options Mar 9 2011, 4:35 pm
From: Charles Oliver Nutter <head...@headius.com>
Date: Thu, 10 Mar 2011 06:35:55 +0900
Local: Wed, Mar 9 2011 4:35 pm
Subject: [ruby-core:35473] Re: MRI silently handles .so files as Ruby sources

Just when I thought I knew all load-searching oddities :)

If you look at the JRuby bug you'll see that it's a very specific case
and I show several scenarios that either work or don't work...

* Only fails over for "extension" extensions like .so or
.bundle...does not fail over for things like foo.rb.rb or foo.rb.so
* Appears to do a search for both .rb and <extension extension> if the
original filename doesn't work
* Does not fail over to "extension" extensions that are not
appropriate for current platform, like .so.so on OS X

I think it's confusing and unpredictable and would just as soon have
the logic be "if it ends with an extension extension, only search
extension extensions."

- Charlie


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »