Merge pull request #13978 from carlocab/rpath-prefix

formula: ensure `rpath` is passed a valid `target`
This commit is contained in:
Carlo Cabrera 2022-10-11 02:06:20 +08:00 committed by GitHub
commit f30f68be7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1615,6 +1615,10 @@ class Formula
# </pre>
sig { params(source: Pathname, target: Pathname).returns(String) }
def rpath(source: bin, target: lib)
unless target.to_s.start_with?(HOMEBREW_PREFIX)
raise "rpath `target` should only be used for paths inside HOMEBREW_PREFIX!"
end
"#{loader_path}/#{target.relative_path_from(source)}"
end