Don't fail on arbitrary absolute symlinks
Still forbid absolute symlinks including prefix
This commit is contained in:
parent
a8cbcfa080
commit
9c0a2ac933
@ -100,16 +100,11 @@ module Homebrew
|
|||||||
|
|
||||||
def keg_contains_absolute_symlink_starting_with?(string, keg)
|
def keg_contains_absolute_symlink_starting_with?(string, keg)
|
||||||
absolute_symlinks_start_with_string = []
|
absolute_symlinks_start_with_string = []
|
||||||
absolute_symlinks_rest = []
|
|
||||||
keg.find do |pn|
|
keg.find do |pn|
|
||||||
if pn.symlink? && (link = pn.readlink).absolute?
|
if pn.symlink? && (link = pn.readlink).absolute?
|
||||||
if link.to_s.start_with?(string)
|
if link.to_s.start_with?(string)
|
||||||
absolute_symlinks_start_with_string << pn
|
absolute_symlinks_start_with_string << pn
|
||||||
else
|
|
||||||
absolute_symlinks_rest << pn
|
|
||||||
end
|
end
|
||||||
|
|
||||||
result = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -120,16 +115,9 @@ module Homebrew
|
|||||||
puts " #{pn} -> #{pn.resolved_path}"
|
puts " #{pn} -> #{pn.resolved_path}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
unless absolute_symlinks_rest.empty?
|
|
||||||
opoo "Absolute symlink:"
|
|
||||||
absolute_symlinks_rest.each do |pn|
|
|
||||||
puts " #{pn} -> #{pn.resolved_path}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
result
|
!absolute_symlinks_start_with_string.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def bottle_output(bottle)
|
def bottle_output(bottle)
|
||||||
@ -245,12 +233,15 @@ module Homebrew
|
|||||||
ignores << %r{#{Regexp.escape(HOMEBREW_CELLAR)}/go/[\d\.]+/libexec}
|
ignores << %r{#{Regexp.escape(HOMEBREW_CELLAR)}/go/[\d\.]+/libexec}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
relocatable = true
|
||||||
if ARGV.include? "--skip-relocation"
|
if ARGV.include? "--skip-relocation"
|
||||||
relocatable = true
|
|
||||||
skip_relocation = true
|
skip_relocation = true
|
||||||
else
|
else
|
||||||
relocatable = !keg_contains(prefix_check, keg, ignores)
|
relocatable = false if keg_contains(prefix_check, keg, ignores)
|
||||||
relocatable = !keg_contains(cellar, keg, ignores) && relocatable
|
relocatable = false if keg_contains(cellar, keg, ignores)
|
||||||
|
if prefix != prefix_check
|
||||||
|
relocatable = false if keg_contains_absolute_symlink_starting_with?(prefix, keg)
|
||||||
|
end
|
||||||
skip_relocation = relocatable && !keg.require_install_name_tool?
|
skip_relocation = relocatable && !keg.require_install_name_tool?
|
||||||
end
|
end
|
||||||
puts if !relocatable && ARGV.verbose?
|
puts if !relocatable && ARGV.verbose?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user