Help us understand the problem. What is going on with this article?

rbenvで1.8.7をインストールする際のエラーの対処法

More than 5 years have passed since last update.

ちょっと訳あってどうしても1.8.7をインストールする必要があったんですが
centOS6.5でopensslをアップデートしてから(?)rbenvで1.8.7のインストールが失敗するようになりました。
どうもrbenvのバグではなくRubyのopenssl拡張のバグらしい。
ということでrbenvの作者のsstephensonは以下のようにパッチ当ててインストールしたらええがなとGitHubでおっしゃってます。

$ curl -fsSL https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808/diff?format=diff | filterdiff -x ChangeLog | rbenv install --patch 2.0.0-p247

2.0.0-p247 (and lower) と書いてあったのでlowerっつーことは1.8.7でもこのパッチ当てていいのかなと思い試してみたところ

$ curl -fsSL https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808/diff?format=diff | filterdiff -x ChangeLog | rbenv install --patch 1.8.7-p375

Installing ruby-1.8.7-p375...
patching file ext/openssl/ossl_pkey_ec.c
Hunk #1 succeeded at 757 (offset -5 lines).
Hunk #2 succeeded at 813 with fuzz 2 (offset -6 lines).
can't find file to patch at input line 33
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: test/openssl/test_pkey_ec.rb
|===================================================================
|--- test/openssl/test_pkey_ec.rb   (revision 41807)
|+++ test/openssl/test_pkey_ec.rb   (revision 41808)
--------------------------
File to patch:

あかんわ、うまくいかね(^ω^;)
test/openssl/test_pkey_ec.rbが見つからないってこと?
とにかくパスを求められてしまい何を入力してもだめ。

そもそも1.8.7にtest/openssl/test_pkey_ec.rbなんてないんじゃないか?と思って
-x test/openssl/test_pkey_ec.rb を付けて無視してみたところ

$ curl -fsSL https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808/diff?format=diff | filterdiff -x ChangeLog -x test/openssl/test_pkey_ec.rb | rbenv install --patch 1.8.7-p375

Checking out http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7...
Installing ruby-1.8.7-p375...
patching file ext/openssl/ossl_pkey_ec.c
Hunk #1 succeeded at 757 (offset -5 lines).
Hunk #2 succeeded at 813 with fuzz 2 (offset -6 lines).
Installed ruby-1.8.7-p375 to /usr/local/rbenv_data/versions/1.8.7-p375

Downloading rubygems-1.6.2.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/0c95a9869914ba1a45bf71d3b8048420
Installing rubygems-1.6.2...
Installed rubygems-1.6.2 to /usr/local/rbenv_data/versions/1.8.7-p375

$ rbenv versions
  1.8.7-p375
  2.0.0-p451
* 2.1.1 (set by /usr/local/rbenv_data/version)

うまくいったみたい
(^ω^;)おかえり1.8.7
rbenv作者のヒゲ男爵はマジ神。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away