aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2016-07-31 18:44:24 +0100
committerMike McQuaid2016-07-31 19:12:20 +0100
commit3e5ccaf3d2761697a67260bb1ad50be922afe57c (patch)
treed15ae75a998c71dea757087700503814b6aa232e
parent12e7a08b7ad6d209e433a81c732a5d25ea0fbf76 (diff)
downloadbrew-3e5ccaf3d2761697a67260bb1ad50be922afe57c.tar.bz2
link: don't allow more openssl/libressl linkage.
This extends the approach in #597 to further prevent linkage of formulae that conflict with the system OpenSSL and can cause the issues described in that issue.
-rw-r--r--Library/Homebrew/cmd/link.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb
index d7ea2427c..6486e6f18 100644
--- a/Library/Homebrew/cmd/link.rb
+++ b/Library/Homebrew/cmd/link.rb
@@ -24,20 +24,22 @@ module Homebrew
mode.dry_run = true if ARGV.dry_run?
ARGV.kegs.each do |keg|
- if HOMEBREW_PREFIX.to_s == "/usr/local" && keg.name == "openssl"
+ keg_only = keg_only?(keg.rack)
+ if HOMEBREW_PREFIX.to_s == "/usr/local" && keg_only &&
+ keg.name.start_with?("openssl", "libressl")
opoo <<-EOS.undent
- Refusing to link: openssl
- Linking keg-only OpenSSL means you may end up linking against the insecure,
- deprecated system version while using the headers from the Homebrew version.
+ Refusing to link: #{keg.name}
+ Linking keg-only #{keg.name} means you may end up linking against the insecure,
+ deprecated system OpenSSL while using the headers from Homebrew's #{keg.name}.
Instead, pass the full include/library paths to your compiler e.g.:
- -I#{HOMEBREW_PREFIX}/opt/openssl/include -L#{HOMEBREW_PREFIX}/opt/openssl/lib
+ -I#{HOMEBREW_PREFIX}/opt/#{keg.name}/include -L#{HOMEBREW_PREFIX}/opt/#{keg.name}/lib
EOS
next
elsif keg.linked?
opoo "Already linked: #{keg}"
puts "To relink: brew unlink #{keg.name} && brew link #{keg.name}"
next
- elsif keg_only?(keg.rack) && !ARGV.force?
+ elsif keg_only && !ARGV.force?
opoo "#{keg.name} is keg-only and must be linked with --force"
puts "Note that doing so can interfere with building software."
next