Update, February 17, 2012: This is still an issue with Ruby 1.9.3-p125 when compiled via rbenv/ruby-build. The same fix applies; see below.
If your Ruby installation is affected, it is very easy to crash the interpreter by using TLS. We were bitten by this bug when our app attempted to send email via TLS-enabled SMTP. Even a trivial Gemfile can trigger a segmentation fault. Bundler 1.1.rc.7 and Rails 3.2.0.rc2 now create a Gemfile so that it starts with an https URL, like this:
# A sample Gemfile source "https://rubygems.org" gem "rails"
bundle install on this simple Gemfile with Ruby 1.9.3-p0 and you might be greeted by this nasty error (edited for brevity):
$ bundle install Fetching gem metadata from [https://rubygems.org/.](https://rubygems.org/.) net/http.rb:799: [BUG] Segmentation fault ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] -- Control frame information ----------------------------------------------- c:0041 p:---- s:0225 b:0225 l:000224 d:000224 CFUNC :connect c:0040 p:0011 s:0222 b:0222 l:000c90 d:000221 BLOCK net/http.rb:799
It turns out that this crash, like another recent Ruby headache, has something to do with MacPorts. Chris Irish explains the problem in detail, as it occurs with Ruby 1.9.2-p290. At 55 Minutes we encountered it on two different Macs, both running Ruby 1.9.3-p0.
The solution is to recompile Ruby using the
--with-openssl-dir=/opt/local flag. Here’s how to do it (these instructions assume you have the openssl port installed in the default
/opt/local location; in my case it is openssl version 1.0.0e):
rbenv + ruby-build
CONFIGURE_OPTS="--with-openssl-dir=/opt/local" rbenv install 1.9.3-p0
rvm install ruby-1.9.3 --with-openssl-dir=/opt/local --with-iconv-dir=/opt/local