From: Daniel Berger Date: 2005-07-16T00:20:52+09:00 Subject: Re: RoR example and segmentation fault! JZ wrote: > I tried add new ticket "Elite Journal" example I found in docs section of > RoR but I get "Precondition Failed. The precondition on the request for the > URL /newticket evaluated to false." So I send the problem here: > > PROBLEM: After login I cannot click on anything because I get segmentation > fault :( I am using windows xp pro sp2. The problem looks serious and I am > afraid of stability RoR on win32 system... > c:/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_e > xt/string/../../inflector.rb:41: [BUG] Segmentation fault > ruby 1.8.2 (2004-12-25) [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. > --------------------------------- Curious. Line 41 of inflector.rb is simply this: class_name_in_module.to_s.gsub(/^.*::/, '') This converts strings like "Foo::Bar" to "Bar". I've done some testing with .to_s.gsub in order to try to cause a segfault on my WinXP Pro box, but I can't do it. I've tried millions of iterations using empty strings, nil, numbers - still works fine. To narrow it down, add the following code above line 41: File.open("C:\\temp.log","w+"){ |fh| fh.puts("class name was: #{class_name_to_module}") } Next time it segfaults, take a look at temp.log and see what it says. If that isn't helpful, try replacing line 41 with this line: class_name_in_module.to_s.split("::").last It does the same thing, though it's a bit slower. If it works, then we know it's somehow related to gsub. If it doesn't work, then the real issue lies elsewhere. Regards, Dan