Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Properly handle missing binary libraries. #2019

Merged
merged 1 commit into from Aug 4, 2013
Merged

Conversation

eendeego
Copy link
Contributor

@eendeego eendeego commented Jul 8, 2012

After removing a binary library dependency from my project (in this case: libffi), bundler started to crash on simple commands as:

rake -T

Error message:

rake aborted!
undefined method `gsub' for nil:NilClass
...

Running rake -T --trace yields:

rake aborted!
undefined method `gsub' for nil:NilClass
/Users/sample/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:77:in `rescue in rescue in block in require'
/Users/sample/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:72:in `rescue in block in require'
/Users/sample/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:62:in `block in require'
/Users/sample/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `each'
/Users/sample/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `require'
...

After applying this patch, running rake -T yields:

rake aborted!
dlopen(/Users/sample/.rvm/gems/ruby-1.9.3-p194@gemset/gems/ffi-1.0.11/lib/ffi_c.bundle, 9): Library not loaded: /opt/local/lib/libffi.5.dylib
  Referenced from: /Users/sample/.rvm/gems/ruby-1.9.3-p194@gemset/gems/ffi-1.0.11/lib/ffi_c.bundle
  Reason: image not found - /Users/sample/.rvm/gems/ruby-1.9.3-p194@gemset/gems/ffi-1.0.11/lib/ffi_c.bundle

I couldn't find tests for these kinds of errors, but if they exist and someone can give some directions, I'll add tests to the patch.

@travisbot
Copy link

This pull request passes (merged fd521a2 into 17e7f34).

@dvandersluis
Copy link

I'm running into the same sort of problem with a cannot open shared object file error. Perhaps:

raise e unless $1

@cookrn
Copy link

cookrn commented Jul 11, 2012

Here's a full issue report: https://gist.github.com/4fab89b4051b5bc0cfbb

In my case, the ffi-geos gem is the believed culprit.

@rohitarondekar
Copy link
Contributor

This looks like a nice addition. I don't know about tests but it doesn't seem like there are any like this. I guess you would need to create a test lib that required ffi and pretend to load a non existing dependency and check if the correct error is raised. But that doesn't sound so good. @indirect @hone thoughts?

@eendeego
Copy link
Contributor Author

Dunno, it looks like @carlhuda and/or the other mantainers are flooded with other more urgent issues... this has been rotting here for a while.

@indirect
Copy link
Member

The test for this should just raise an error that looks like the FFI error that we want to catch. This is a good patch, and I'll see about getting a test written myself if one isn't forthcoming.

indirect added a commit that referenced this pull request Aug 4, 2013
Properly handle missing binary libraries.
@indirect indirect merged commit fd521a2 into rubygems:master Aug 4, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants