Sponsors

mysql.rb errors after upgrading ruby 7

Posted by Darshan Patil Thu, 09 Aug 2007 05:34:00 GMT

I just noticed that my rails projects broke after I upgraded ruby on my linux box. Projects that had gems and rails frozen break. This is because of code in the SHA1 class not being backward compatible.

To quickly fix a broken rails app that shows the following error:
vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:551:in `initialize'

edit the mysql.rb file so that the scramble41 routine looks like:

  def scramble41(password, message)
    return 0x00.chr if password.nil? or password.empty?
    buf = [0x14]
    s1 = Digest::SHA1.digest(password)
    s2 = Digest::SHA1.digest(s1)
    x = Digest::SHA1.digest(message + s2)
    (0..s1.length - 1).each {|i| buf.push(s1[i] ^ x[i])}
    buf.pack("C*")
  end
Trackbacks

Use the following link to trackback from your own site:
http://scattrbrain.com/articles/trackback/186

Comments

Leave a response

  1. Tina Mon, 10 Sep 2007 17:17:11 GMT

    Man you don’t even know how long I’ve waited for this since disabling my own Movable Type widget (that doesn’t work since Haloscan bypasses that code).

    THANK YOU!

  2. Set Fri, 14 Sep 2007 22:32:03 GMT

    aaaaaaaaaaaaa, man, I had the same problem! I’m not alone! :)

  3. Snorri Tue, 23 Oct 2007 10:37:44 GMT

    Thanke you so much!

  4. mj Tue, 23 Oct 2007 12:34:57 GMT

    I tried this but now I get a different error: MySQL Connection dropped during query….anyone see anything like that? What version of Ruby did you upgrade to that caused this error?

  5. Rick K Mon, 14 Jan 2008 04:07:37 GMT

    I was installing Mephisto and hit this – voila!

    Thank you!

  6. Neil Wed, 16 Jan 2008 03:46:09 GMT

    Like the rest, thanks.

  7. jason Wed, 30 Jan 2008 08:09:41 GMT

    worked!

Comments