Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brew command has died for external taps #3421

Closed
4 tasks done
DomT4 opened this issue Nov 4, 2017 · 3 comments
Closed
4 tasks done

brew command has died for external taps #3421

DomT4 opened this issue Nov 4, 2017 · 3 comments
Assignees
Labels
bug Reproducible Homebrew/brew bug

Comments

@DomT4
Copy link
Member

DomT4 commented Nov 4, 2017

Please always follow these steps:

  • Confirmed this is a problem with running a brew command and not brew installing or the post-install behaviour of one or more formulae? If it's a formulae-specific problem please file this issue at the relevant tap e.g. for Homebrew/homebrew-core https://github.com/Homebrew/homebrew-core/issues/new
  • Ran brew update and retried your prior step?
  • Ran brew doctor, fixed all issues and retried your prior step?
  • Ran brew config and brew doctor and included their output with your issue?
HOMEBREW_VERSION: 1.3.6-169-g2af9813
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 2af98133ba9083a9620703be78357a227deaeef6
Last commit: 25 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: c13c5d7c20aa21a857eb8a40742e07c4ecab5947
Core tap last commit: 45 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.3.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 9.0 build 900
Git: 2.15.0 => /usr/local/opt/git/bin/git
Perl: /usr/local/bin/perl => /usr/local/Cellar/perl/5.26.1/bin/perl
Python: /usr/local/opt/python/libexec/bin/python => /usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/local/var/rbenv/shims/ruby => /usr/local/var/rbenv/versions/2.4.2/bin/ruby
Java: 9.0.1
macOS: 10.13.2-x86_64
Xcode: 9.1
CLT: 9.0.1.0.1.1506734476
X11: N/A
Your system is ready to brew.

brew command has stopped working for external taps. Reproduction:

brew tap homebrew/command-not-found
brew command command-not-found-init
Error: Unknown command: command-not-found-init

Or anything really. Fails with brew command bundle, as well as my own external taps.

Running git checkout stable fixes it. The commit that broke it seems to be 29f8181, but beyond reverting it locally to check I haven't had a minute yet to poke at it properly 🙈.

@ilovezfs ilovezfs added the bug Reproducible Homebrew/brew bug label Nov 4, 2017
@amyspark
Copy link
Contributor

amyspark commented Nov 5, 2017

By default:

internal_cmd = true

Since command-not-found-init is not an internal command (i.e. none of the require? HOMEBREW_LIBRARY_PATH/* lines in the block below will find it)

if cmd
internal_cmd = require? HOMEBREW_LIBRARY_PATH/"cmd"/cmd
unless internal_cmd
internal_cmd = require? HOMEBREW_LIBRARY_PATH/"dev-cmd"/cmd
if internal_cmd && !ARGV.homebrew_developer?
system "git", "config", "--file=#{HOMEBREW_REPOSITORY}/.git/config",
"--replace-all", "homebrew.devcmdrun", "true"
ENV["HOMEBREW_DEV_CMD_RUN"] = "1"
end
end
end

internal_cmd will never change from true, thus never loading the PATH with the Taps' commands...

unless internal_cmd
# Add contributed commands to PATH before checking.
tap_cmds = Pathname.glob(Tap::TAP_DIRECTORY/"*/*/cmd")
homebrew_path.append(tap_cmds)
# External commands expect a normal PATH
ENV["PATH"] = homebrew_path
end

...and this is how 29f8181 broke the feature.

/cc @MikeMcQuaid

@ghost ghost assigned MikeMcQuaid Nov 5, 2017
@ghost ghost added the in progress Maintainers are working on this label Nov 5, 2017
@MikeMcQuaid
Copy link
Member

Thanks @DomT4 and @amyspark for the debugging help. I've opened #3423 to address this.

@amyspark just FYI that was a great write-up and we'd love your debugging skills for future bugs too!

@ghost ghost removed the in progress Maintainers are working on this label Nov 5, 2017
@DomT4
Copy link
Member Author

DomT4 commented Nov 6, 2017

Thanks for looking into this @amyspark, really appreciate that. 💯 on the formatting of the explanation as well, couldn't have done it better if I'd tried.

I've been absolutely snowed under with studies lately 😓, otherwise I'd have tried to take a look myself rather than accidentally shunting it onto others. Thanks for the PR as well @MikeMcQuaid ❤️.

@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
bug Reproducible Homebrew/brew bug
Projects
None yet
Development

No branches or pull requests

4 participants