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>
This commit is contained in:
Martin Afanasjew 2016-02-15 17:56:47 +01:00
parent 01d642f150
commit c20809526c

View File

@ -41,7 +41,15 @@ module RubyMachO
end end
mach_data mach_data
rescue MachO::NotAMachOError
# Silently ignore errors that indicate the file is not a Mach-O binary ...
[]
rescue 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
end end