Rugged uses wrong OpenSSL version
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 2.3k
- Forks
- 293
- PR merge metrics
- No merged PRs in 30d
Description
While upgrading to Ruby 2.3.4, I had to compile a custom OpenSSL version because it depends on v1.0.x whereas my Arch Linux was already on v1.1. So it was compiled with --with-openssl-dir=$HOME/.rvm/usr --with-gcc=clang.
But it seems rugged still loads libssl and libcrypto from /usr/lib instead, resulting in a null pointer access violation:
/home/marcus/.rvm/gems/ruby-2.3.4@evopark/gems/rugged-0.26.0/lib/rugged/rugged.so: [BUG] Segmentation fault at 0x00000000000000
-- Machine register context ------------------------------------------------
RIP: 0x00007fe6e82a3afa RBP: 0x000056463ccb39b0 RSP: 0x00007ffebd4a81d8
RAX: 0x0000000000000000 RBX: 0x0000564631f7fdc0 RCX: 0x0000000000000100
RDX: 0x0000000000000000 RDI: 0x0000000000000000 RSI: 0x0000000000000000
R8: 0x0000000000000000 R9: 0x0000000000000020 R10: 0x0000000000000013
R11: 0x00007fe6e02ac910 R12: 0x0000000000000002 R13: 0x000056463157c138
R14: 0x000056463ccb39d0 R15: 0x00007fe6e6b46bd0 EFL: 0x0000000000010283
-- C level backtrace information -------------------------------------------
/home/marcus/.rvm/rubies/ruby-2.3.4/lib/libruby.so.2.3(rb_vm_bugreport+0x1cd) [0x7fe6e9386a0d] vm_dump.c:692
/home/marcus/.rvm/rubies/ruby-2.3.4/lib/libruby.so.2.3(rb_bug_context+0x1dd) [0x7fe6e922e45d] error.c:435
/home/marcus/.rvm/rubies/ruby-2.3.4/lib/libruby.so.2.3(sigsegv+0x40) [0x7fe6e92fc650] signal.c:890
/usr/lib/libpthread.so.0 [0x7fe6e8faa7e0]
/usr/lib/libc.so.6(__strcmp_sse2_unaligned+0x1a) [0x7fe6e82a3afa]
/home/marcus/.rvm/usr/lib/libcrypto.so.1.0.0(lh_insert+0x9d) [0x7fe6e6bcdf4d]
/home/marcus/.rvm/usr/lib/libcrypto.so.1.0.0(OBJ_NAME_add+0x60) [0x7fe6e6b47010]
/usr/lib/libssl.so.1.1 [0x7fe6e02d7923]
/usr/lib/libpthread.so.0 [0x7fe6e8fa7bdf]
/usr/lib/libcrypto.so.1.1(CRYPTO_THREAD_run_once+0xa) [0x7fe6dffda64a]
/usr/lib/libssl.so.1.1(OPENSSL_init_ssl+0x8d) [0x7fe6e02d7b5d]
/home/marcus/.rvm/gems/ruby-2.3.4@evopark/gems/rugged-0.26.0/lib/rugged/rugged.so(git_openssl_stream_global_init+0x17) [0x7fe6ce8fac97] /home/marcus/.rvm/gems/ruby-2.3.4@evopark/gems/rugged-0.26.0/vendor/libgit2/src/openssl_stream.c:110
/home/marcus/.rvm/gems/ruby-2.3.4@evopark/gems/rugged-0.26.0/lib/rugged/rugged.so(init_once+0x68) [0x7fe6ce8de8e8] /home/marcus/.rvm/gems/ruby-2.3.4@evopark/gems/rugged-0.26.0/vendor/libgit2/src/global.c:64
/usr/lib/libpthread.so.0 [0x7fe6e8fa7bdf]
/home/marcus/.rvm/gems/ruby-2.3.4@evopark/gems/rugged-0.26.0/lib/rugged/rugged.so(git_libgit2_init+0x43) [0x7fe6ce8de983] /home/marcus/.rvm/gems/ruby-2.3.4@evopark/gems/rugged-0.26.0/vendor/libgit2/src/global.c:278
/home/marcus/.rvm/gems/ruby-2.3.4@evopark/gems/rugged-0.26.0/lib/rugged/rugged.so(Init_rugged+0x2aa) [0x7fe6ce8aab1a] rugged.c:608
/home/marcus/.rvm/rubies/ruby-2.3.4/lib/libruby.so.2.3(dln_load+0xeb) [0x7fe6e91e61cb] dln.c:1355
/home/marcus/.rvm/rubies/ruby-2.3.4/lib/libruby.so.2.3(rb_vm_call_cfunc+0x109) [0x7fe6e9378219] vm.c:1962
/home/marcus/.rvm/rubies/ruby-2.3.4/lib/libruby.so.2.3(rb_require_internal+0x681) [0x7fe6e923bee1] load.c:1002
(this is a shortened version with the parts I thought to be most relevant, if you need more information, don't hesitate to ask)
Since I didn't see any explicit references to loading OpenSSL in this gem, I guess that it's a problem with the Rubygems build system, which I'm unfortunately not familiar with. But maybe someone else has seen this problem and knows a workaround for it?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with Ruby 2.3.4, the custom OpenSSL 1.0.x build, and Arch Linux. Inspect vendor/libgit2/src/openssl_stream.c, vendor/libgit2/src/global.c, and the native build configuration to trace which libssl and libcrypto versions rugged loads. Done means rugged consistently uses the configured OpenSSL libraries without the reported segmentation fault.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, ruby
- Domain
- backend, build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100