Module: OS::Linux::FormulaCellarChecks Private
- Included in:
- FormulaCellarChecks
- Defined in:
- extend/os/linux/formula_cellar_checks.rb
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Instance Method Summary collapse
-
#binary_program?(file) ⇒ Boolean
private
A position-independent executable is
ET_DYNlike a shared library. - #valid_library_extension?(filename) ⇒ Boolean private
Instance Method Details
#binary_program?(file) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
A position-independent executable is ET_DYN like a shared library. A
dynamic one names a loader, as a shared library may, and a static one
only carries the PIE flag, so fall back to how the library is named.
16 17 18 19 20 21 22 23 24 |
# File 'extend/os/linux/formula_cellar_checks.rb', line 16 def binary_program?(file) # Cheapest first: the name, then the ELF header, then its program # headers, which are parsed rather than read at a fixed offset. return false if valid_library_extension?(file) return true if super return false unless file.is_a?(ELFShim) file.dylib? && (file.interpreter.present? || file.pie?) end |
#valid_library_extension?(filename) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
8 9 10 |
# File 'extend/os/linux/formula_cellar_checks.rb', line 8 def valid_library_extension?(filename) super || filename.basename.to_s.include?(".so.") end |