|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Routing problem with JRuby/RailsHi everyone,
I just got started on JRuby, and tried to run our Rails application with it. I ran into a problem, which I debbugged (see description below) - however I'm not quite sure what to do with it. The root cause is rails assuming a particular quirk of the Dir[...] method, which JRuby doesn't replicate. So I have monkeypatched my Rails for now, but I'm not sure if this should be "fixed" in JRuby or taken to Rails... Problem description: JRuby interferes with routing where there is the following arrangement of controllers * something_controller.rb * something/ +- sub_controller.rb this will not correctly match the 'something/sub' controller. The reason being: * The Route#recognize method will engage in creating meta-methods that match against regular expressions. (From Route#write_recognition) * For the default route, this will eventually land in ControllerSegment#regexp_chunk? * This will query Routing#possible_controllers * This method will collect the file paths from the controllers, using Dir.../**/*_controller.rb" The controllers are then put into the regular expression. For MRI, the Dir method reports files in subdirectories first. The JRuby implementation does not. As a result the 'something' is put into the regexp first, and 'something/sub' is matched as (something)/(sub). For MRI, 'something/ sub' is tested first, and it is correctly matched as (something/sub). Ciao, Daniel -- Daniel Hahn Software Architect hahn@... Net7 Via Marche 8a - 56123 Pisa http://www.netseven.it/ --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Routing problem with JRuby/RailsOn Wed, May 14, 2008 at 4:55 AM, Daniel Hahn <hahn@...> wrote:
> Problem description: > > JRuby interferes with routing where there is the following arrangement of > controllers > > * something_controller.rb > * something/ +- sub_controller.rb > > this will not correctly match the 'something/sub' controller. The reason > being: > > * The Route#recognize method will engage in creating meta-methods that > match against regular expressions. (From Route#write_recognition) > * For the default route, this will eventually land in > ControllerSegment#regexp_chunk? > * This will query Routing#possible_controllers > * This method will collect the file paths from the controllers, using > Dir.../**/*_controller.rb" > > The controllers are then put into the regular expression. > > For MRI, the Dir method reports files in subdirectories first. The JRuby > implementation does not. Interesting! So you can confirm that the Dir[...] ordering is what breaks it? We should be able to fix that -- I'd want to add to the rubyspecs to ensure that this case is covered. /Nick --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Routing problem with JRuby/RailsHi Daniel,
Great analysis! Could you please submit a jira issue for that, with some minimized example that shows the differences between MRI and JRuby (otherwise, I'm not fully sure that I properly understand the test case from your description). Once we have the test, the fix should be (hopefully) simple. And, we could put the test case into rubyspecs too. Thanks, --Vladimir On Wed, May 14, 2008 at 11:55 AM, Daniel Hahn <hahn@...> wrote: > Hi everyone, > > I just got started on JRuby, and tried to run our Rails application with it. > I ran into a problem, which I debbugged (see description below) - however > I'm not quite sure what to do with it. The root cause is rails assuming a > particular quirk of the Dir[...] method, which JRuby doesn't replicate. So I > have monkeypatched my Rails for now, but I'm not sure if this should be > "fixed" in JRuby or taken to Rails... > > Problem description: > > JRuby interferes with routing where there is the following arrangement of > controllers > > * something_controller.rb > * something/ +- sub_controller.rb > > this will not correctly match the 'something/sub' controller. The reason > being: > > * The Route#recognize method will engage in creating meta-methods that > match against regular expressions. (From Route#write_recognition) > * For the default route, this will eventually land in > ControllerSegment#regexp_chunk? > * This will query Routing#possible_controllers > * This method will collect the file paths from the controllers, using > Dir.../**/*_controller.rb" > > The controllers are then put into the regular expression. > > For MRI, the Dir method reports files in subdirectories first. The JRuby > implementation does not. > > As a result the 'something' is put into the regexp first, and > 'something/sub' is matched as (something)/(sub). For MRI, 'something/sub' is > tested first, and it is correctly matched as (something/sub). > > Ciao, > Daniel > > > -- > Daniel Hahn > Software Architect > hahn@... > > Net7 > Via Marche 8a - 56123 Pisa > http://www.netseven.it/ > > > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Routing problem with JRuby/RailsOn Wed, May 14, 2008 at 8:32 AM, Vladimir Sizikov <vsizikov@...> wrote:
> Hi Daniel, > > Great analysis! Could you please submit a jira issue for that, with > some minimized example that shows the differences between MRI and > JRuby (otherwise, I'm not fully sure that I properly understand the > test case from your description). > > Once we have the test, the fix should be (hopefully) simple. And, we > could put the test case into rubyspecs too. This spec appears to cause the problem: http://is.gd/grR I'll push it to the main rubyspec repo as soon as I can get a commit bit from Brian. /Nick --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Routing problem with JRuby/RailsHi,
I was out of office yesterday afternoon. In any case, I don't have a test case but I can give a reasonably easy way to reproduce this. But is issue JRUBY-2519 (filed yesterday) already about this? Ciao, Daniel Il giorno 14/mag/08, alle ore 15:32, Vladimir Sizikov ha scritto: > Hi Daniel, > > Great analysis! Could you please submit a jira issue for that, with > some minimized example that shows the differences between MRI and > JRuby (otherwise, I'm not fully sure that I properly understand the > test case from your description). > > Once we have the test, the fix should be (hopefully) simple. And, we > could put the test case into rubyspecs too. > > Thanks, > --Vladimir > > On Wed, May 14, 2008 at 11:55 AM, Daniel Hahn <hahn@...> > wrote: >> Hi everyone, >> >> I just got started on JRuby, and tried to run our Rails application >> with it. >> I ran into a problem, which I debbugged (see description below) - >> however >> I'm not quite sure what to do with it. The root cause is rails >> assuming a >> particular quirk of the Dir[...] method, which JRuby doesn't >> replicate. So I >> have monkeypatched my Rails for now, but I'm not sure if this >> should be >> "fixed" in JRuby or taken to Rails... >> >> Problem description: >> >> JRuby interferes with routing where there is the following >> arrangement of >> controllers >> >> * something_controller.rb >> * something/ +- sub_controller.rb >> >> this will not correctly match the 'something/sub' controller. The >> reason >> being: >> >> * The Route#recognize method will engage in creating meta-methods >> that >> match against regular expressions. (From Route#write_recognition) >> * For the default route, this will eventually land in >> ControllerSegment#regexp_chunk? >> * This will query Routing#possible_controllers >> * This method will collect the file paths from the controllers, >> using >> Dir.../**/*_controller.rb" >> >> The controllers are then put into the regular expression. >> >> For MRI, the Dir method reports files in subdirectories first. The >> JRuby >> implementation does not. >> >> As a result the 'something' is put into the regexp first, and >> 'something/sub' is matched as (something)/(sub). For MRI, >> 'something/sub' is >> tested first, and it is correctly matched as (something/sub). >> >> Ciao, >> Daniel >> >> >> -- >> Daniel Hahn >> Software Architect >> hahn@... >> >> Net7 >> Via Marche 8a - 56123 Pisa >> http://www.netseven.it/ >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > -- Daniel Hahn Software Architect hahn@... Net7 Via Marche 8a - 56123 Pisa http://www.netseven.it/ --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Routing problem with JRuby/RailsOn Thu, May 15, 2008 at 4:59 AM, Daniel Hahn <hahn@...> wrote:
> Hi, > > I was out of office yesterday afternoon. In any case, I don't have a test > case but I can give a reasonably easy way to reproduce this. But is issue > JRUBY-2519 (filed yesterday) already about this? No, I think this problem is suitably different and warrants its own bug. I've filed one here: http://jira.codehaus.org/browse/JRUBY-2525 /Nick --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |