Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

brew update is overzealous about linking tapped formula #19743

Closed
phinze opened this issue May 12, 2013 · 2 comments
Closed

brew update is overzealous about linking tapped formula #19743

phinze opened this issue May 12, 2013 · 2 comments

Comments

@phinze
Copy link
Contributor

phinze commented May 12, 2013

After e613cbe the definition for where a Formula should be stored in a Tap was restricted to (1) root dir, (2) Formula dir, or (3) HomebrewFormula dir.

This works nicely, and in my project we exploit it to distribute a single formula in a Tap that also contains our Casks.

However, we've been fighting an issue (Homebrew/homebrew-cask#47) for awhile now where people are getting stray symlinks after running brew update. I think I may have found the culprit. The update Report is not being consistent about the policy I outlined above.

Have a look:

  def tapped_formula_for key
    fetch(key, []).map do |path|
      case path when %r{^Library/Taps/(\w+-\w+/.*)}
        Pathname.new($1)
      end
    end.compact
  end

https://github.com/mxcl/homebrew/blob/59c0b3f916c9a2bd141bc4a79199fa720c88f04f/Library/Homebrew/cmd/update.rb#L155-L161

That there is going to match any file in the directory that gets add it, and pass it up to:

https://github.com/mxcl/homebrew/blob/59c0b3f916c9a2bd141bc4a79199fa720c88f04f/Library/Homebrew/cmd/update.rb#L53

Which will happily link it.

Does it make sense to you folks that this should be scoped down to match the policy in the tap command? If so I can try for a PR.

Thanks for all the work you do! Homebrew is 🆒 😎 🍔 :)

@mistydemeo
Copy link
Member

Report#tapped_formula_for should definitely be using the Pathname methods rather than reinventing the logic.

phinze added a commit to phinze/homebrew that referenced this issue Jul 9, 2013
a tapped formula is a ruby file present:

- in the root of the tap
- in directory of the tap called Formula
- in a directory of the tap called HomebrewFormula

and nowhere else. this corrects an overzealous definition of tapped
formula in the updater. (the correct definition has been in Pathname
since e613cbe)

refs Homebrew#19743
jacknagel pushed a commit that referenced this issue Jul 10, 2013
A tapped formula is a ruby file present:

  - in the root of the tap
  - in directory of the tap called Formula
  - in a directory of the tap called HomebrewFormula

And nowhere else. This corrects an overzealous definition of tapped
formula in the updater. (the correct definition has been in Pathname
since e613cbe)

Refs #19743.
Closes #21087.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
@phinze
Copy link
Contributor Author

phinze commented Jul 10, 2013

This landed last night, so we should be good to go. Thanks you guys are the best.

@phinze phinze closed this as completed Jul 10, 2013
handyman5 pushed a commit to handyman5/homebrew that referenced this issue Oct 7, 2013
A tapped formula is a ruby file present:

  - in the root of the tap
  - in directory of the tap called Formula
  - in a directory of the tap called HomebrewFormula

And nowhere else. This corrects an overzealous definition of tapped
formula in the updater. (the correct definition has been in Pathname
since e613cbe)

Refs Homebrew#19743.
Closes Homebrew#21087.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants