formula: ensure rpath is passed a valid target
Setting `target` to a path outside `HOMEBREW_PREFIX` is not portable, and will be invalid for some Homebrew installations. If we want to add an `rpath` outside of `HOMEBREW_PREFIX`, we should just use the absolute path instead. See discussion at Homebrew/homebrew-core#110520.
This commit is contained in:
parent
e23d7b6360
commit
252e398b78
@ -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)
|
||||
odie "`target` should only be used for paths inside HOMEBREW_PREFIX!"
|
||||
end
|
||||
|
||||
"#{loader_path}/#{target.relative_path_from(source)}"
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user