Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

dbconsole crashes if you have a numeric password

#1395

if you are using MySQL and try to run script/dbconsole without the "-p" flag and you have a number [0-9] only password on database.yml then somehow it gets parsed as Fixnum and it will trigger an exception at line 44 of vendor/rails/railties/lib/commands/dbconsole.rb complaining that a number doesn't have the empty? method (NoMethodError).

The quick fix for that is to append .to_s in that to ensure that even it is a number it will get parsed ok. Here goes how i think it should be:

elsif config['password'] && !config['password'].to_s.empty?

instead of

elsif config['password'] && !config['password'].empty?

I've attached a git patch for fixing that.

Reported by pfagiani (at gmail) · November 17th, 2008 @ 10:14 PM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Frederick Cheung
    Frederick Cheung

    Editing your database.yml so that it reads

    
    database_name:
      ...
      password: "1337"
    

    should do the trick

    December 18th, 2008 @ 11:17 AM

  2. Anderson Dias
    Anderson Dias

    Frederick, I made this patch with pfagiani and we know we can use this alternative to solve the problem, but, I don't think that it's the better solution. :D The dbconsole should understand a non string password as other rails modules currently do.

    December 18th, 2008 @ 01:53 PM

  3. Frederick Cheung
    Frederick Cheung

    Ah fine, was just suggesting a workaround if this was an immediate problem for people

    December 18th, 2008 @ 02:21 PM

  4. Anderson Dias
    Anderson Dias

    Fine, thank you Frederick. :D

    December 18th, 2008 @ 02:50 PM

  5. Repository
    Repository
    • State changed from new to resolved

    (from [7cda0df7f1511a10c515165dbce76e5c68b654ff]) Fix script/dbconsole not handling numeric password [#1395 dbconsole crashes if you have a numeric password state:resolved]

    Signed-off-by: Frederick Cheung frederick.cheung@gmail.com http://github.com/rails/rails/co...

    December 21st, 2008 @ 07:05 PM