-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.9 compatibility #2
Comments
Here's a crude patch. Too in-the-middle-of-debugging-something to do the whole clone/fork/fix thing. Let's home github's edit widget doesn't trash things too much. Anyways, it's a two-minute manual fix (to three locations). --- lib-orig/unix_crypt.rb 2011-12-16 17:48:15.699145334 -0500
|
Yeh, as I thought, github hosed it. The fix: append .ord to the string subscript in lines 23, 25, 27, 29, 30, and 97. Works fine after that. |
Hi mkfs - it looks like you're working off old code there. Someone submitted a patch in February that should fix compatibility with 1.9. Can you confirm all is well? |
I was using the gem hosted at rubygems.org -- it does not have the patch. I did a clone of your github and built/installed a gem from that (btw, the gemspec needs a version bump) and it works fine in Ruby 1.9: ruby-1.9.2-head :001 > require 'unix_crypt' |
Could you update the gem on rubygems.org? I need to distribute my own gems with unix-crypt as a requirement, which kills my own compatibility for 1.9.x. |
Gem pushed. |
Awesome, thanks! |
UnixCrypt.build causes a TypeError when used under Ruby 1.9.x:
TypeError at unix_crypt.rb line: 97
String can't be coerced into Fixnum
The line in question is:
ds = digest.digest(salt * (16 + a[0]))
...where 'salt' and 'a' are both strings.
The problem here is that in Ruby 1.8.x, String#[] returns a byte value, while in Ruby 1.9.x it returns a character or substring.
The way to fix this is to use String.bytes, e.g.
The text was updated successfully, but these errors were encountered: