New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent loading all non-Bundler gems #10695
Conversation
Review period will end on 2021-02-25 at 18:08:29 UTC. |
I cannot reproduce that It should be in the
and therefore unaffected by any |
Library/Homebrew/load_path.rb
Outdated
@@ -7,7 +7,20 @@ | |||
|
|||
$LOAD_PATH.push HOMEBREW_LIBRARY_PATH.to_s | |||
|
|||
require "utils/gems" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be tempted to move this require to brew.rb
instead. This file is also used by rubocops.rb
.
Bootsnap? The |
I don't think that actually is being used on Linux:
Call path appears to be |
I think I figured it out - we (intentionally) remove non-existent directories from the
I'll play around with it. |
Whoops, should revert that as it's not intentional. |
b9bc39c
to
9efd67a
Compare
The last commit should fix the Ruby crash issue once and for all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brew/Library/Homebrew/test/dev-cmd/test_spec.rb
Lines 9 to 10 in 485f73a
# randomly segfaults on Linux with portable-ruby. | |
it "tests a given Formula", :integration_test, :needs_macos do |
:needs_macos
. This is looking good, though.
Review period ended. |
9f786ab
to
d998a51
Compare
Enabling that test immediately finds a bug! Fixed that now. (I've also made the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @Bo98, looks like this is uncovering a bunch of 🐛 too. If the scope here is getting a little large feel free to extract any of it into a separate PR e.g. just the minitest changes.
We are migrating away from using system gems, and we already have minitest in our dependency tree, so we might as well use it.
Portable Ruby crashes if the $LOAD_PATH gets too big.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 👍🏻
Related? Homebrew/discussions#953 |
We do not ship a I suspect the user is actually wanting to use system Ruby however, which would make sense for formula build scripts specifically. This probably broke because So we can either:
I'll try out the former just now because it looks interesting. |
Is there a way now to allow specific Gems which are not in the |
I have a fix for For more complex scenarios, |
Merged now:
Also works on subsequent runs - |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?This prevents random user-installed gems from breaking
brew
in various ways, including but not limited to:fileutils
, causingbrew
to not load. [When brew is used, an error is reported:'/usr/local/opt/libyaml/lib/libyaml-0.2.dylib' not found #10520, Homebrew won't install on M1 Mac (macOS 11.2.1) #10684, many many discussions]brew
isn't responsible for. [always error output: Ignoring redcarpet-3.5.0 because its extensions are not built. Try: gem pristine redcarpet --version 3.5.0 #10649, Brew is 'Ignoring ffi-1.13.1 because its extensions are not built.' #10675, Ruby errors on every brew upgrade #10688]brew
has not been tested against. [undefined method `assertions' for main:Object #2984]Prior discussion in #7681.