aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMartin Afanasjew2016-02-15 17:56:47 +0100
committerMartin Afanasjew2016-02-25 21:54:42 +0100
commitc20809526c4f3c794de592dbde2663bb0da28451 (patch)
tree89c48b01f113fd77744cf03d593765cf762a44fa /Library
parent01d642f150c90ac8a6e7ec266f8c424a8f197bc4 (diff)
downloadbrew-c20809526c4f3c794de592dbde2663bb0da28451.tar.bz2
os/mac/ruby_mach: don't hide actual parse errors
The current approach of suppressing all output regardless of what the error is makes it very hard to debug any issues and misread but valid Mach-O files will be silently interpreted as non-Mach-O files instead. Prefer to fail if we are a Homebrew developer or running on the bot (`HOMEBREW_DEVELOPER=1`), so that problems will be noticed and fixed before the silent failure leads to hard-to-diagnose user problems. Closes Homebrew/homebrew#48817. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/os/mac/ruby_mach.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/os/mac/ruby_mach.rb b/Library/Homebrew/os/mac/ruby_mach.rb
index 3cd0ac0b9..adef7b661 100644
--- a/Library/Homebrew/os/mac/ruby_mach.rb
+++ b/Library/Homebrew/os/mac/ruby_mach.rb
@@ -41,7 +41,15 @@ module RubyMachO
end
mach_data
+ rescue MachO::NotAMachOError
+ # Silently ignore errors that indicate the file is not a Mach-O binary ...
+ []
rescue
+ # ... but complain about other (parse) errors for further investigation.
+ if ARGV.homebrew_developer?
+ onoe "Failed to read Mach-O binary: #{self}"
+ raise
+ end
[]
end
end