Ruby Digest :: SHA512.hexdigest throws segment error and exits in Yosemite

We have an earlier REE rails app that I am running on-premise on OSX Yosemite. I recently switched from Mavericks, which I had no problem with. I ran this app for the first time on my new working mac and found that I was unable to login due to it dropping the segment error and logging out of the local webrick server. After some investigation, I found the culprit:

digest = Digest::SHA512.hexdigest('some_arbitrary_value')

      

On further investigation, I found that this line of code is throwing the following error:

[BUG] Segmentation fault
ruby 1.8.7 (2013-06-27 MBARI 8/0x6770 on patchlevel 374) [i686-darwin14.3.0], MBARI 0x6770, Ruby Enterprise Edition 2012.02

      

... and exits the ruby ​​console.

Both Ruby 1.8.7 and REE produce this issue on my OSX Yosemite machine. Ruby version 1.9.3 and newer seems to produce the expected error-free hash.

Why is it Digest::SHA512.hexdigest

generating an error [BUG] Segmentation fault

after switching from OSX Mavericks to Yosemite?

+3


source to share


3 answers


I had the same problem with the version ree-1.8.7-2012.02

from ruby ​​and Max OS X Yosemite and since all the solutions I found on the internet don't work for me, after some tests I found a solution.

You only need to change Digest::SHA512.hexdigest(digest)

to OpenSSL::Digest::SHA512.new(digest).hexdigest

and it will work fine.



This is a bit awkward because you need to change the code throughout your application, but as a last resource, it works.

+6


source


Decision:

You need to make sure ruby ​​is built using the old version of openssl.

I downloaded 0.9.8 openssl into a directory (~ / builds / openssl-0.9.8zg), built it but did NOT install it. When you install ruby ​​version point rvm to openssl 0.9.8 directory



rvm reinstall 1.8.7-p374 --autolibs=0 --with-openssl=~/builds/openssl-0.9.8zg

      

This worked for me, and rails 2.3.18 is now up and running under Yosemite.

+1


source


I don't have an answer, but I have exactly the same problem.

Interestingly, I am migrating from a Mac running Yosemite to a brand new Mac that also runs Yosemite. The old mac doesn't have a seg fault error. Both machines use Yosemite, rvm, ruby ​​1.8.7

But I noticed that the "new mac" is using openssl 1.0.2c on June 12, 2015, and the "old mac" is using openssl 1.0.1c on May 10, 2012.

Could it be related to compiling the SSL version of the libraries?

Sorry I didn't give an answer, but thought it might be worth mentioning if it helps.

I keep researching and reporting any successes here.

Update:

'old mac'

ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'

      

reported OpenSSL 0.9.8r Feb 8, 2011

"new mac" announces OpenSSL 1.0.2c on June 12, 2015

0


source







All Articles