Bug in dispatcher.rb?

I’m developing my app against Ror 2.0, and I noticed my public/
500.html page was not rendered in response to some low level errors
(like when I stopped MySql). So I did some debugging to figure out
why. After some digging I think I’m seeing a bug in the way
dispatcher.rb looks for the error pages.

This seems incredible to me. How could such a basic bug not be
detected?

But the code I’m looking at sure looks wrong. The filename it
constructs for the 500.html page has an extra space in it: “public/
500 .html”

Here’s my diff:

C:\projects[…]\vendor\rails>svn diff .
Index: actionpack/lib/action_controller/dispatcher.rb

— actionpack/lib/action_controller/dispatcher.rb (revision
9641)
+++ actionpack/lib/action_controller/dispatcher.rb (working copy)
@@ -61,7 +61,7 @@

   private
     def failsafe_response_body(status)
  •      error_path = "#{error_file_path}/#{status.to_s[0..3]}.html"
    
  •      error_path = "#{error_file_path}/#{status}.html"
    
         if File.exist?(error_path)
           File.read(error_path)
    

I’ve tested this on WinXP and OS X with the same results. I tried
searching this group and the lighthouse bug db, but I see no other
references to this problem… I did find a 9-month old Trac ticket
reporting this problem, but the old Trac system is obsolete, right?
(http://dev.rubyonrails.org/ticket/9305) What am I missing?

I wasn’t aware ANY request went through dispatcher.rb.

Correct me if I’m wrong.

On Thu, May 22, 2008 at 5:43 AM, KC [email protected] wrote:

But the code I’m looking at sure looks wrong. The filename it
+++ actionpack/lib/action_controller/dispatcher.rb (working copy)
I’ve tested this on WinXP and OS X with the same results. I tried
searching this group and the lighthouse bug db, but I see no other
references to this problem… I did find a 9-month old Trac ticket
reporting this problem, but the old Trac system is obsolete, right?
(http://dev.rubyonrails.org/ticket/9305) What am I missing?


Appreciated my help?
Recommend me on Working With Rails
http://workingwithrails.com/person/11030-ryan-bigg

@KC – Are you seeing this in production? Seems more likely that
it’s a development issue (ie., all requests considered local via your /
environment/development.rb) so that you see the error page that helps
you debug. I see a page with backtrace in dev (WinXP and Ubuntu) but
the expected 500 page if an error occurs in production.

On May 21, 8:31 pm, “Ryan B. (Radar)” [email protected]

All my testing has been in development instances. I’ll try production
now. Makes sense that the routing would be different in the
production environment.

But the code in question is in need or repair. It attempts to show
the 500 or 404 page and fails due to the string formatting error.

I can verify that this code is called in at least one context: when I
shut down my MySql server and attempted a request that involved active
record. No idea if this is

On May 21, 5:31 pm, “Ryan B. (Radar)” [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs