Merge pull request #13978 from carlocab/rpath-prefix
formula: ensure `rpath` is passed a valid `target`
This commit is contained in:
		
						commit
						f30f68be7d
					
				@ -1615,6 +1615,10 @@ class Formula
 | 
				
			|||||||
  # </pre>
 | 
					  # </pre>
 | 
				
			||||||
  sig { params(source: Pathname, target: Pathname).returns(String) }
 | 
					  sig { params(source: Pathname, target: Pathname).returns(String) }
 | 
				
			||||||
  def rpath(source: bin, target: lib)
 | 
					  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)}"
 | 
					    "#{loader_path}/#{target.relative_path_from(source)}"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user