Skip to content

Conversation

alex
Copy link
Contributor

@alex alex commented Mar 29, 2018

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

Formula/rust.rb Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The revision needs to be removed

@ilovezfs
Copy link
Contributor

@BrewTestBot test this please

@fxcoudert
Copy link
Member

Error: Failed changing dylib ID of /usr/local/Cellar/rust/1.25.0/share/rust/rust_src/llvm-emscripten/test/Object/Inputs/macho-invalid-dylib-id-more-than-one
  from foo
    to /usr/local/opt/rust/share/rust/rust_src/llvm-emscripten/test/Object/Inputs/foo
Error: Failed to fix install linkage

So apparently as part of rust sources, we're now shipping some object files and binaries… and even some invalid ones 😱

@fxcoudert
Copy link
Member

It even makes our audit fail:

        Error: Failed to read Mach-O binary: /usr/local/Cellar/rust/1.25.0/share/rust/rust_src/llvm-emscripten/test/Object/Inputs/macho-invalid-dyld-name_offset-toobig
Error: undefined method `partition' for nil:NilClass
/usr/local/Homebrew/Library/Homebrew/vendor/macho/macho/load_commands.rb:284:in `initialize'
/usr/local/Homebrew/Library/Homebrew/vendor/macho/macho/load_commands.rb:530:in `new'
/usr/local/Homebrew/Library/Homebrew/vendor/macho/macho/load_commands.rb:530:in `initialize'
/usr/local/Homebrew/Library/Homebrew/vendor/macho/macho/load_commands.rb:198:in `new'
/usr/local/Homebrew/Library/Homebrew/vendor/macho/macho/load_commands.rb:198:in `new_from_bin'
/usr/local/Homebrew/Library/Homebrew/vendor/macho/macho/macho_file.rb:496:in `block in populate_load_commands'
/usr/local/Homebrew/Library/Homebrew/vendor/macho/macho/macho_file.rb:485:in `times'
/usr/local/Homebrew/Library/Homebrew/vendor/macho/macho/macho_file.rb:485:in `populate_load_commands'
/usr/local/Homebrew/Library/Homebrew/vendor/macho/macho/macho_file.rb:235:in `populate_fields'
/usr/local/Homebrew/Library/Homebrew/vendor/macho/macho/macho_file.rb:46:in `initialize'

@ilovezfs
Copy link
Contributor

The

 rm_rf Dir["src/{llvm,test,librustdoc,etc/snapshot.pyc}"]

is supposed to handle that. So probably just need to throw some new dirs at it.

@ilovezfs
Copy link
Contributor

CC @woodruffw that audit fail is nifty

@woodruffw
Copy link
Member

woodruffw commented Mar 29, 2018

Yeah, my understanding is that Rust ships with all of binaries that LLVM uses in its unit tests, including malformed ones. Updating the glob should fix the problem.

Looks like the audit failure begins when we run check_openssl_links, which tries to iterate over all the Mach-O files and then explodes when it gets to a malformed one. I'll take this malformed binary and see if I can make the inner error thrown by ruby-macho better, but at least this confirms that mach_data's rescue works correctly 🙂 :

    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

@ilovezfs
Copy link
Contributor

@BrewTestBot test this please

@fxcoudert
Copy link
Member

Thanks @alex

@fxcoudert fxcoudert closed this in 4f2a2b9 Mar 29, 2018
@alex alex deleted the patch-1 branch March 29, 2018 20:56
@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants