language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | Homebrew | brew | a6f25419aaaeb5fae3eb743d961ed7892ae86075.json | Update vendored gems
- backports to 3.11.4
- plist to 3.4.0 | Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/plist-3.4.0/lib/plist/version.rb | @@ -1,5 +1,5 @@
# encoding: utf-8
module Plist
- VERSION = '3.3.0'.freeze
+ VERSION = '3.4.0'.freeze
end | true |
Other | Homebrew | brew | d44290571931b5c83934b31d97b58b8e2bc32c06.json | Upgrade: implement linkage repair
After upgrading existing kegs, we now search and upgrade their
dependents as well. If any are detected that have broken linkage, they
are reinstalled from source.
If there are any formulae in the dependents tree that are pinned, they
are only reinstalled if they're not outdated; in a... | Library/Homebrew/cmd/reinstall.rb | @@ -7,6 +7,7 @@
require "formula_installer"
require "development_tools"
require "messages"
+require "reinstall"
module Homebrew
module_function
@@ -26,59 +27,4 @@ def reinstall
end
Homebrew.messages.display_messages
end
-
- def reinstall_formula(f)
- if f.opt_prefix.directory?
- keg = Keg... | true |
Other | Homebrew | brew | d44290571931b5c83934b31d97b58b8e2bc32c06.json | Upgrade: implement linkage repair
After upgrading existing kegs, we now search and upgrade their
dependents as well. If any are detected that have broken linkage, they
are reinstalled from source.
If there are any formulae in the dependents tree that are pinned, they
are only reinstalled if they're not outdated; in a... | Library/Homebrew/cmd/upgrade.rb | @@ -21,6 +21,7 @@
#: are pinned; see `pin`, `unpin`).
require "install"
+require "reinstall"
require "formula_installer"
require "cleanup"
require "development_tools"
@@ -80,6 +81,16 @@ def upgrade
puts formulae_upgrades.join(", ")
end
+ upgrade_formulae(formulae_to_install)
+
+ check_depe... | true |
Other | Homebrew | brew | d44290571931b5c83934b31d97b58b8e2bc32c06.json | Upgrade: implement linkage repair
After upgrading existing kegs, we now search and upgrade their
dependents as well. If any are detected that have broken linkage, they
are reinstalled from source.
If there are any formulae in the dependents tree that are pinned, they
are only reinstalled if they're not outdated; in a... | Library/Homebrew/reinstall.rb | @@ -0,0 +1,63 @@
+require "formula_installer"
+require "development_tools"
+require "messages"
+
+module Homebrew
+ module_function
+
+ def reinstall_formula(f, build_from_source: false)
+ if f.opt_prefix.directory?
+ keg = Keg.new(f.opt_prefix.resolved_path)
+ keg_had_linked_opt = true
+ keg_was_li... | true |
Other | Homebrew | brew | d44290571931b5c83934b31d97b58b8e2bc32c06.json | Upgrade: implement linkage repair
After upgrading existing kegs, we now search and upgrade their
dependents as well. If any are detected that have broken linkage, they
are reinstalled from source.
If there are any formulae in the dependents tree that are pinned, they
are only reinstalled if they're not outdated; in a... | Library/Homebrew/test/cmd/upgrade_spec.rb | @@ -7,4 +7,14 @@
expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory
end
+
+ it "upgrades a Formula and cleans up old versions" do
+ setup_test_formula "testball"
+ (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
+
+ expect { brew "upgrade", "--cleanup" }.to be_a_success
+
+ expect(HOMEBREW_CE... | true |
Other | Homebrew | brew | e6409f6a096bc458e97ebed216dc19ddddaa3edf.json | Increase the unit test coverage of messages.rb
This increases the messages.rb unit test coverage to 100%. | Library/Homebrew/test/messages_spec.rb | @@ -2,49 +2,109 @@
require "spec_helper"
describe Messages do
- before do
- @m = Messages.new
- f_foo = formula("foo") do
- url "https://example.com/foo-0.1.tgz"
- end
- f_bar = formula("bar") do
- url "https://example.com/bar-0.1.tgz"
- end
- f_baz = formula("baz") do
- url "https... | false |
Other | Homebrew | brew | a9d363fdfed53803955903374ae2cc8bf76251bd.json | docs/Maintainer-Guidelines: retire lead maintainer position in Febuary. | docs/Maintainer-Guidelines.md | @@ -152,3 +152,22 @@ In the same way that Homebrew maintainers are expected to be spending more of th
Individual Homebrew repositories should not have formal lead maintainers (although those who do the most work will have the loudest voices).
Maintainers should feel even more free to pleasantly disagree with the wo... | false |
Other | Homebrew | brew | 769d89deaddfa95bf9ea4a9ef977c8c68101a6e3.json | Resolve formulae in `brew cleanup`. | Library/Homebrew/cleanup.rb | @@ -166,7 +166,7 @@ def clean!
else
args.each do |arg|
formula = begin
- Formula[arg]
+ Formulary.resolve(arg)
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
nil
end | true |
Other | Homebrew | brew | 769d89deaddfa95bf9ea4a9ef977c8c68101a6e3.json | Resolve formulae in `brew cleanup`. | Library/Homebrew/extend/ARGV.rb | @@ -54,35 +54,7 @@ def formulae
def resolved_formulae
require "formula"
@resolved_formulae ||= (downcased_unique_named - casks).map do |name|
- if name.include?("/") || File.exist?(name)
- f = Formulary.factory(name, spec)
- if f.any_version_installed?
- tab = Tab.for_formula(f)... | true |
Other | Homebrew | brew | 769d89deaddfa95bf9ea4a9ef977c8c68101a6e3.json | Resolve formulae in `brew cleanup`. | Library/Homebrew/formulary.rb | @@ -47,6 +47,38 @@ def self.load_formula_from_path(name, path)
cache[path] = klass
end
+ def self.resolve(name, spec: nil)
+ if name.include?("/") || File.exist?(name)
+ f = factory(name, *spec)
+ if f.any_version_installed?
+ tab = Tab.for_formula(f)
+ resolved_spec = spec || tab.... | true |
Other | Homebrew | brew | b46852da4c87256a4114b7bb0e28e0a102e622f3.json | components_order_cop: add more components | Library/Homebrew/rubocops/components_order_cop.rb | @@ -33,6 +33,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
[{ name: :conflicts_with, type: :method_call }],
[{ name: :skip_clean, type: :method_call }],
[{ name: :cxxstdlib_check, type: :method_call }],
+ [{ name: :link_overwrite, type: :meth... | false |
Other | Homebrew | brew | a1264f5adad20be663ca28ab3ef11c5be54694aa.json | components_order_cop: add more components | Library/Homebrew/rubocops/components_order_cop.rb | @@ -22,6 +22,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
[{ name: :head, type: :method_call }],
[{ name: :stable, type: :block_call }],
[{ name: :bottle, type: :block_call }],
+ [{ name: :pour_bottle?, type: :block_call }],
... | false |
Other | Homebrew | brew | dc7b73171c0fa2bcced8ae32413af47dd1ab7a84.json | cmd/update: follow GitHub API redirects.
Fixes #4867 | Library/Homebrew/cmd/update.sh | @@ -482,7 +482,7 @@ EOS
fi
UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL" --silent --max-time 3 \
- --output /dev/null --write-out "%{http_code}" \
+ --location --output /dev/null --write-out "%{http_code}" \
--dump-header "$DIR/.git/GITHUB_HEADERS" \
--user-a... | false |
Other | Homebrew | brew | cc620dbecb25efbc2e664c9dde9fc5f02b78a2fa.json | docs/Maintainer-Guidelines: address more comments. | docs/Maintainer-Guidelines.md | @@ -7,7 +7,7 @@ definitely not a beginner’s guide.
Maybe you were looking for the [Formula Cookbook](Formula-Cookbook.md)?
-This document is a work in progress. If you wish to change or discuss any of the below: open a PR to suggest a change.
+This document is current practice. If you wish to change or discuss any... | false |
Other | Homebrew | brew | 28061369dc4f11b3fcbbf790c95858f53e1c3e21.json | Cask: show previous verison in cask upgrade | Library/Homebrew/cask/cmd/upgrade.rb | @@ -28,7 +28,14 @@ def run
ohai "Casks with `auto_updates` or `version :latest` will not be upgraded" if args.empty? && !greedy?
oh1 "Upgrading #{Formatter.pluralize(outdated_casks.length, "outdated package")}, with result:"
- puts outdated_casks.map { |f| "#{f.full_name} #{f.version}" } * ",... | false |
Other | Homebrew | brew | 6c3b8e100f0f3dc23fe6c77cfd049ba126e58e8c.json | components_order_cop: add all components | Library/Homebrew/rubocops/components_order_cop.rb | @@ -27,9 +27,14 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
[{ name: :bottle, type: :method_call }],
[{ name: :keg_only, type: :method_call }],
[{ name: :option, type: :method_call }],
+ [{ name: :deprecated_option, type: :method_call }],... | false |
Other | Homebrew | brew | 5f18f0bb03c72af19952e2573db6881eb84257f0.json | Determine remote_url using git config | Library/Homebrew/dev-cmd/bump-formula-pr.rb | @@ -325,7 +325,11 @@ def bump_formula_pr
odie "Unable to fork: #{e.message}!"
end
- remote_url = response.fetch("clone_url")
+ if system("git", "config", "--local", "--get-regexp", "remote\..*\.url", "git@github.com:.*")
+ remote_url = response.fetch("ssh_url")
+ else... | false |
Other | Homebrew | brew | 53b95c62604fb902425c93aa01d68dc873067635.json | Cask: use native chmod to set write permissions
Ruby chmod follows symlinks, which can point to non-existent files. This
should fix quarantining Casks e.g. disk-inventory-x. | Library/Homebrew/cask/quarantine.rb | @@ -121,7 +121,7 @@ def propagate(from: nil, to: nil)
resolved_paths = Pathname.glob(to/"**/*", File::FNM_DOTMATCH)
- FileUtils.chmod "u+w", resolved_paths
+ system_command!("/bin/chmod", args: ["-R", "u+w", to])
quarantiner = system_command("/usr/bin/xargs",
... | false |
Other | Homebrew | brew | 18d38d7b7699a4fd6750cc9c38609ada6ecf0fd7.json | Add brew shellenv - see #4780 | Library/Homebrew/cmd/shellenv.rb | @@ -0,0 +1,16 @@
+#: * `shellenv`:
+#: Prints export statements - run them in a shell and this installation of
+#: Homebrew will be included into your PATH, MANPATH, and INFOPATH.
+#: Tip: have your dotfiles eval the output of this command
+
+module Homebrew
+ module_function
+
+ def shellenv
+ puts <<~E... | true |
Other | Homebrew | brew | 18d38d7b7699a4fd6750cc9c38609ada6ecf0fd7.json | Add brew shellenv - see #4780 | Library/Homebrew/test/cmd/shellenv_spec.rb | @@ -0,0 +1,8 @@
+describe "brew shellenv", :integration_test do
+ it "doesn't fail" do
+ expect { brew "shellenv" }
+ .to output(%r{#{HOMEBREW_PREFIX}/bin}).to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
+end | true |
Other | Homebrew | brew | 18d38d7b7699a4fd6750cc9c38609ada6ecf0fd7.json | Add brew shellenv - see #4780 | docs/Manpage.md | @@ -441,6 +441,11 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
If `--env=std` is passed, use the standard `PATH` instead of superenv's.
+ * `shellenv`:
+ Prints export statements - run them in a shell and this installation of
+ Homebrew will be included into your PA... | true |
Other | Homebrew | brew | 18d38d7b7699a4fd6750cc9c38609ada6ecf0fd7.json | Add brew shellenv - see #4780 | manpages/brew.1 | @@ -404,6 +404,9 @@ If \fB\-\-desc\fR is passed, search formulae with a description matching \fItext
If \fB\-\-env=std\fR is passed, use the standard \fBPATH\fR instead of superenv\'s\.
.
.IP "\(bu" 4
+\fBshellenv\fR: Prints export statements \- run them in a shell and this installation of Homebrew will be included ... | true |
Other | Homebrew | brew | 9d8b101ede241df5973b1d4ec5290a7fbc0d56dc.json | docs/Maintainer-Guidelines: address maintainer feedback. | docs/Maintainer-Guidelines.md | @@ -107,9 +107,8 @@ is a good opportunity to do it) provided the line itself has some kind
of modification that is not whitespace in it. But be careful about
making changes to inline patches—make sure they still apply.
-### Adding formulae
-Only one maintainer is necessary to approve and merge the addition of a new... | false |
Other | Homebrew | brew | 7fd22bcda513c4cb1db30de8afccdc31f44d9f73.json | docs: fix typo from #4845. | docs/C++-Standard-Libraries.md | @@ -14,7 +14,7 @@ so Homebrew will refuse to install software if a dependency was built with an
incompatible C++ library. It's recommended that you install the dependency tree
using a compatible compiler.
-**If you've upgraded to or later 10.9 from an earlier version** - because the default C++
+**If you've upgrade... | false |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/cleanup.rb | @@ -271,8 +271,8 @@ def cleanup_path(path)
def cleanup_lockfiles(*lockfiles)
return if dry_run?
- if lockfiles.empty? && HOMEBREW_LOCK_DIR.directory?
- lockfiles = HOMEBREW_LOCK_DIR.children.select(&:file?)
+ if lockfiles.empty? && HOMEBREW_LOCKS.directory?
+ lockfiles = HOMEBREW_L... | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/cmd/reinstall.rb | @@ -14,6 +14,8 @@ module Homebrew
def reinstall
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
+ Install.perform_preinstall_checks
+
ARGV.resolved_formulae.each do |f|
if f.pinned?
onoe "#{f.full_name} is pinned. You must unpin it to reinstall." | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/config.rb | @@ -24,7 +24,7 @@
HOMEBREW_PINNED_KEGS = HOMEBREW_PREFIX/"var/homebrew/pinned"
# Where we store lock files
-HOMEBREW_LOCK_DIR = HOMEBREW_PREFIX/"var/homebrew/locks"
+HOMEBREW_LOCKS = HOMEBREW_PREFIX/"var/homebrew/locks"
# Where we store built products
HOMEBREW_CELLAR = Pathname.new(ENV["HOMEBREW_CELLAR"]) | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/diagnostic.rb | @@ -71,6 +71,12 @@ def inject_file_list(list, string)
end
############# END HELPERS
+ def fatal_install_checks
+ %w[
+ check_access_directories
+ ].freeze
+ end
+
def development_tools_checks
%w[
check_for_installed_developer_tools
@@ -293,115 ... | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/formula_installer.rb | @@ -205,7 +205,7 @@ def build_bottle_postinstall
def install
start_time = Time.now
if !formula.bottle_unneeded? && !pour_bottle? && DevelopmentTools.installed?
- Homebrew::Install.check_development_tools
+ Homebrew::Install.perform_development_tools_checks
end
# not in initialize so u... | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/install.rb | @@ -17,39 +17,36 @@ def check_ppc
end
end
- def check_writable_install_location
- if HOMEBREW_CELLAR.exist? && !HOMEBREW_CELLAR.writable_real?
- raise "Cannot write to #{HOMEBREW_CELLAR}"
+ def attempt_directory_creation
+ Keg::MUST_BE_WRITABLE_DIRECTORIES.each do |dir|
+ beg... | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/keg.rb | @@ -1,4 +1,5 @@
require "keg_relocate"
+require "language/python"
require "lock_file"
require "ostruct"
@@ -64,18 +65,41 @@ def to_s
# locale-specific directories have the form language[_territory][.codeset][@modifier]
LOCALEDIR_RX = %r{(locale|man)/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?}
... | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/lock_file.rb | @@ -5,7 +5,7 @@ class LockFile
def initialize(name)
@name = name.to_s
- @path = HOMEBREW_LOCK_DIR/"#{@name}.lock"
+ @path = HOMEBREW_LOCKS/"#{@name}.lock"
@lockfile = nil
end
| true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/test/cleanup_spec.rb | @@ -27,8 +27,8 @@
end
describe Homebrew::Cleanup do
- let(:ds_store) { Pathname.new("#{HOMEBREW_PREFIX}/Library/.DS_Store") }
- let(:lock_file) { Pathname.new("#{HOMEBREW_LOCK_DIR}/foo") }
+ let(:ds_store) { Pathname.new("#{HOMEBREW_CELLAR}/.DS_Store") }
+ let(:lock_file) { Pathname.new("#{HOMEBREW_LOCKS}/foo")... | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/test/diagnostic_spec.rb | @@ -29,64 +29,25 @@
end
end
- specify "#check_access_homebrew_repository" do
+ specify "#check_access_directories" do
begin
- mode = HOMEBREW_REPOSITORY.stat.mode & 0777
- HOMEBREW_REPOSITORY.chmod 0555
-
- expect(subject.check_access_homebrew_repository)
- .to match("#{HOMEBREW_R... | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/test/spec_helper.rb | @@ -32,7 +32,7 @@
HOMEBREW_CACHE,
HOMEBREW_CACHE_FORMULA,
HOMEBREW_CELLAR,
- HOMEBREW_LOCK_DIR,
+ HOMEBREW_LOCKS,
HOMEBREW_LOGS,
HOMEBREW_TEMP,
].freeze
@@ -134,13 +134,9 @@ def find_files
FileUtils.rm_rf [
TEST_DIRECTORIES.map(&:children),
+ *Keg::MUST_EXIST_DIRECTORIES,
... | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/test/support/lib/config.rb | @@ -27,7 +27,7 @@
HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent/"formula_cache"
HOMEBREW_LINKED_KEGS = HOMEBREW_PREFIX.parent/"linked"
HOMEBREW_PINNED_KEGS = HOMEBREW_PREFIX.parent/"pinned"
-HOMEBREW_LOCK_DIR = HOMEBREW_PREFIX.parent/"locks"
+HOMEBREW_LOCKS = HOMEBREW_PREFIX.parent/"locks"
HOMEBR... | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | Library/Homebrew/update_migrator.rb | @@ -341,9 +341,7 @@ def migrate_legacy_repository_if_necessary
EOS
end
- (Keg::ALL_TOP_LEVEL_DIRECTORIES + ["Cellar"]).each do |dir|
- FileUtils.mkdir_p "#{HOMEBREW_PREFIX}/#{dir}"
- end
+ Keg::MUST_EXIST_DIRECTORIES.each { |dir| FileUtils.mkdir_p dir }
src = Pathname.ne... | true |
Other | Homebrew | brew | 7615d3a8121a251dc747ddcbe3e040ddf64963d6.json | Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.
Fixes #4626. | docs/Troubleshooting.md | @@ -11,7 +11,7 @@ Follow these steps to fix common problems:
* Run `brew update` twice.
* Run `brew doctor` and fix all the warnings (**outdated Xcode/CLT and unbrewed dylibs are very likely to cause problems**).
* Check that **Command Line Tools for Xcode (CLT)** and **Xcode** are up to date.
-* If commands fail wi... | true |
Other | Homebrew | brew | 9db1feb3da20348828bf16280a8eafa010a80522.json | docs/Maintainer-Guidelines: add more guidelines. | docs/Maintainer-Guidelines.md | @@ -7,6 +7,8 @@ definitely not a beginner’s guide.
Maybe you were looking for the [Formula Cookbook](Formula-Cookbook.md)?
+This document is a work in progress. If you wish to change or discuss any of the below: open a PR to suggest a change.
+
## Quick checklist
This is all that really matters:
@@ -105,6 +107... | false |
Other | Homebrew | brew | c6b6fc678e66668b08d31e7a55950768e0e4d687.json | dev-cmd/edit: simplify project view handling.
The way Homebrew is structured now there’s no need to manually
specify a few different directories here. | Library/Homebrew/dev-cmd/edit.rb | @@ -26,36 +26,15 @@ def edit
end
# If no brews are listed, open the project root in an editor.
- if ARGV.named.empty?
- editor = File.basename which_editor
- if ["atom", "subl", "mate"].include?(editor)
- # If the user is using Atom, Sublime Text or TextMate
- # give a nice projec... | false |
Other | Homebrew | brew | 78d4db2755995ff56736582758ad97f8d76c814c.json | Use classes for instance doubles. | Library/Homebrew/test/cache_store_spec.rb | @@ -98,7 +98,7 @@
describe "#close_if_open!" do
context "database open" do
before(:each) do
- subject.instance_variable_set(:@db, instance_double("db", close: nil))
+ subject.instance_variable_set(:@db, instance_double(DBM, close: nil))
end
it "does not raise an error when `... | true |
Other | Homebrew | brew | 78d4db2755995ff56736582758ad97f8d76c814c.json | Use classes for instance doubles. | Library/Homebrew/test/cask/artifact/installer_spec.rb | @@ -1,6 +1,6 @@
describe Hbc::Artifact::Installer, :cask do
let(:staged_path) { mktmpdir }
- let(:cask) { instance_double("Cask", staged_path: staged_path, config: nil) }
+ let(:cask) { instance_double(Hbc::Cask, staged_path: staged_path, config: nil) }
subject(:installer) { described_class.new(cask, **args) }... | true |
Other | Homebrew | brew | 33ce424399b429be79c8cc6f009fd14530350721.json | Remove redundant namespacing. | Library/Homebrew/cask/audit.rb | @@ -64,27 +64,27 @@ def check_untrusted_pkg
return if tap.nil?
return if tap.user != "Homebrew"
- return unless cask.artifacts.any? { |k| k.is_a?(Hbc::Artifact::Pkg) && k.stanza_options.key?(:allow_untrusted) }
+ return unless cask.artifacts.any? { |k| k.is_a?(Artifact::Pkg) && k.stanza_option... | true |
Other | Homebrew | brew | 33ce424399b429be79c8cc6f009fd14530350721.json | Remove redundant namespacing. | Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-absolute-target.rb | @@ -1,3 +1,3 @@
cask 'generic-artifact-absolute-target' do
- artifact 'Caffeine.app', target: "#{Hbc::Config.global.appdir}/Caffeine.app"
+ artifact 'Caffeine.app', target: "#{appdir}/Caffeine.app"
end | true |
Other | Homebrew | brew | 33ce424399b429be79c8cc6f009fd14530350721.json | Remove redundant namespacing. | Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact.rb | @@ -5,5 +5,5 @@
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage 'https://example.com/with-generic-artifact'
- artifact 'Caffeine.app', target: "#{Hbc::Config.global.appdir}/Caffeine.app"
+ artifact 'Caffeine.app', target: "#{appdir}/Caffeine.app"
end | true |
Other | Homebrew | brew | eac60b0876e69087941d8d3f2189f5e4f646b495.json | Add test for RuboCop `$LOAD_PATH`. | Library/Homebrew/test/rubocop_spec.rb | @@ -0,0 +1,18 @@
+require "open3"
+
+describe "RuboCop" do
+ context "when calling `rubocop` outside of the Homebrew environment" do
+ before do
+ ENV.keys.each do |key|
+ ENV.delete(key) if key.start_with?("HOMEBREW_")
+ end
+
+ ENV["XDG_CACHE_HOME"] = "#{HOMEBREW_CACHE}/style"
+ end
+
+ ... | false |
Other | Homebrew | brew | 6aa7b47ae194a02f5b6e8cda2ce3c69e161ee5c9.json | scm shim: handle edge case
Since #4748 `HOMEBREW_GIT` is set by the `brew.sh`, whose value is default to be `git`.
As a result, it completely bypasses the logic of the shims/scm/git.
This fixes the issue by checking whether `HOMEBREW_GIT` and
`HOMEBREW_SVN` are set to be `git` and `svn` respectively.
Fixes #4825. | Library/Homebrew/shims/scm/git | @@ -85,10 +85,16 @@ fi
case "$(lowercase "$SCM_FILE")" in
git)
- [[ -n "$HOMEBREW_GIT" ]] && safe_exec "$(type -P "$HOMEBREW_GIT")" "$@"
+ if [[ -n "$HOMEBREW_GIT" && "$HOMEBREW_GIT" != git ]]
+ then
+ safe_exec "$(type -P "$HOMEBREW_GIT")" "$@"
+ fi
;;
svn)
- [[ -n "$HOMEBREW_SVN" ]] ... | false |
Other | Homebrew | brew | ed6f2829b18a52b25f57d3317ab63ada1c6f7f86.json | Cask: check support of quarantine's tools
- In some cases (usually old CLT versions) Swift is available but needs an
extra guard to use the quarantine API.
- xattr's native filesystem recursion is an Apple extension which is
not available in Mojave; so let's use xargs.
- Insert a quarantine support check in brew cask ... | Library/Homebrew/cask/cmd/doctor.rb | @@ -22,6 +22,7 @@ def summary_header
def run
check_software_versions
+ check_quarantine_support
check_install_location
check_staging_location
check_taps
@@ -116,6 +117,23 @@ def check_environment_variables
(locale_variables + environment_variables).sort.each(... | true |
Other | Homebrew | brew | ed6f2829b18a52b25f57d3317ab63ada1c6f7f86.json | Cask: check support of quarantine's tools
- In some cases (usually old CLT versions) Swift is available but needs an
extra guard to use the quarantine API.
- xattr's native filesystem recursion is an Apple extension which is
not available in Mojave; so let's use xargs.
- Insert a quarantine support check in brew cask ... | Library/Homebrew/cask/installer.rb | @@ -186,7 +186,7 @@ def extract_primary_container
return unless quarantine?
return unless Quarantine.available?
- Quarantine.propagate(from: @downloaded_path, to: @cask.staged_path, command: @command)
+ Quarantine.propagate(from: @downloaded_path, to: @cask.staged_path)
end
def ins... | true |
Other | Homebrew | brew | ed6f2829b18a52b25f57d3317ab63ada1c6f7f86.json | Cask: check support of quarantine's tools
- In some cases (usually old CLT versions) Swift is available but needs an
extra guard to use the quarantine API.
- xattr's native filesystem recursion is an Apple extension which is
not available in Mojave; so let's use xargs.
- Insert a quarantine support check in brew cask ... | Library/Homebrew/cask/quarantine.rb | @@ -12,10 +12,29 @@ def swift
@swift ||= DevelopmentTools.locate("swift")
end
+ def check_quarantine_support
+ odebug "Checking quarantine support"
+
+ if swift.nil?
+ odebug "Swift is not available on this system."
+ return :no_swift
+ end
+
+ api_check = system_comma... | true |
Other | Homebrew | brew | ed6f2829b18a52b25f57d3317ab63ada1c6f7f86.json | Cask: check support of quarantine's tools
- In some cases (usually old CLT versions) Swift is available but needs an
extra guard to use the quarantine API.
- xattr's native filesystem recursion is an Apple extension which is
not available in Mojave; so let's use xargs.
- Insert a quarantine support check in brew cask ... | Library/Homebrew/cask/utils/quarantine.swift | @@ -7,36 +7,41 @@ struct swifterr: TextOutputStream {
mutating func write(_ string: String) { fputs(string, stderr) }
}
-if (CommandLine.arguments.count < 4) {
- exit(2)
-}
-
-let dataLocationUrl: NSURL = NSURL.init(fileURLWithPath: CommandLine.arguments[1])
-
-var errorBag: NSError?
-
-let quarantineProperties:... | true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/build.rb | @@ -190,7 +190,20 @@ def fixopt(f)
build = Build.new(formula, options)
build.install
rescue Exception => e # rubocop:disable Lint/RescueException
- Marshal.dump(e, error_pipe)
+ error_hash = JSON.parse e.to_json
+
+ # Special case: need to recreate BuildErrors in full
+ # for proper analytics reporting and... | true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/dev-cmd/test.rb | @@ -93,9 +93,6 @@ def test
exec(*args)
end
end
- rescue ::Test::Unit::AssertionFailedError => e
- ofail "#{f.full_name}: failed"
- puts e.message
rescue Exception => e # rubocop:disable Lint/RescueException
ofail "#{f.full_name}: failed"
puts ... | true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/exceptions.rb | @@ -352,14 +352,16 @@ def initialize(formula)
end
class BuildError < RuntimeError
- attr_reader :formula, :env
- attr_accessor :options
+ attr_reader :cmd, :args, :env
+ attr_accessor :formula, :options
def initialize(formula, cmd, args, env)
@formula = formula
+ @cmd = cmd
+ @args = args
@... | true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/formula_installer.rb | @@ -744,14 +744,18 @@ def build
raise "Empty installation"
end
rescue Exception => e # rubocop:disable Lint/RescueException
- e.options = display_options(formula) if e.is_a?(BuildError)
+ if e.is_a? BuildError
+ e.formula = formula
+ e.options = options
+ end
+
ignore_interrupts d... | true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/global.rb | @@ -1,5 +1,7 @@
require "pathname"
require "English"
+require "json"
+require "json/add/exception"
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent
| true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/postinstall.rb | @@ -15,7 +15,7 @@
formula.extend(Debrew::Formula) if ARGV.debug?
formula.run_post_install
rescue Exception => e # rubocop:disable Lint/RescueException
- Marshal.dump(e, error_pipe)
+ error_pipe.puts e.to_json
error_pipe.close
exit! 1
end | true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/test.rb | @@ -28,7 +28,7 @@
raise "test returned false" if formula.run_test == false
end
rescue Exception => e # rubocop:disable Lint/RescueException
- Marshal.dump(e, error_pipe)
+ error_pipe.puts e.to_json
error_pipe.close
exit! 1
end | true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/test/formula_installer_spec.rb | @@ -4,6 +4,7 @@
require "tab"
require "test/support/fixtures/testball"
require "test/support/fixtures/testball_bottle"
+require "test/support/fixtures/failball"
describe FormulaInstaller do
define_negated_matcher :need_bottle, :be_bottle_unneeded
@@ -28,7 +29,7 @@ def temporary_install(formula)
Tab.clea... | true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/test/support/fixtures/failball.rb | @@ -0,0 +1,20 @@
+class Failball < Formula
+ def initialize(name = "failball", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil)
+ self.class.instance_eval do
+ stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
+ stable.sha256 TESTBALL_SHA256
+ end
+ super
+... | true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/test/support/lib/config.rb | @@ -8,7 +8,11 @@
TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k|
dir = Dir.mktmpdir("homebrew-tests-", ENV["HOMEBREW_TEMP"] || "/tmp")
- at_exit { FileUtils.remove_entry(dir) }
+ at_exit do
+ # Child processes inherit this at_exit handler, but we don't want them
+ # to clean TEST_TMPDIR up prematur... | true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/test/utils/fork_spec.rb | @@ -0,0 +1,21 @@
+require "utils/fork"
+
+describe Utils do
+ describe "#safe_fork" do
+ it "raises a RuntimeError on an error that isn't ErrorDuringExecution" do
+ expect {
+ described_class.safe_fork do
+ raise "this is an exception in the child"
+ end
+ }.to raise_error(RuntimeEr... | true |
Other | Homebrew | brew | 367629d2897b839e16cdd4b079bde2a521762c53.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/utils/fork.rb | @@ -2,6 +2,26 @@
require "socket"
module Utils
+ def self.rewrite_child_error(child_error)
+ error = if child_error.inner_class == ErrorDuringExecution
+ ErrorDuringExecution.new(child_error.inner["cmd"],
+ status: child_error.inner["status"],
+ o... | true |
Other | Homebrew | brew | 6a38b0189c2a321580ede867870bf10b79dc365c.json | docs/Formula-Cookbook: preach what we practise | docs/Formula-Cookbook.md | @@ -396,12 +396,7 @@ system "make", "target", "VAR2=value1", "VAR2=value2", "VAR3=values can have spa
```
```ruby
-args = %W[
- CC=#{ENV.cc}
- PREFIX=#{prefix}
-]
-
-system "make", *args
+system "make", "CC=#{ENV.cc}", "PREFIX=#{prefix}"
```
Note that values *can* contain unescaped spaces if you use the multi... | false |
Other | Homebrew | brew | 6db4b7220094205424e4174c43319be273a4b9de.json | tap: fix GitHub naming. | Library/Homebrew/tap.rb | @@ -3,9 +3,9 @@
# a {Tap} is used to extend the formulae provided by Homebrew core.
# Usually, it's synced with a remote git repository. And it's likely
-# a Github repository with the name of `user/homebrew-repo`. In such
+# a GitHub repository with the name of `user/homebrew-repo`. In such
# case, `user/repo` wi... | false |
Other | Homebrew | brew | 32ad22395bddf3eda906b70c2b3d814e5af2a498.json | Remove some `#popen_read`s. | Library/Homebrew/extend/os/mac/system_config.rb | @@ -6,12 +6,11 @@ def describe_java
# java_home doesn't exist on all macOSs; it might be missing on older versions.
return "N/A" unless File.executable? "/usr/libexec/java_home"
- java_xml = Utils.popen_read("/usr/libexec/java_home", "--xml", "--failfast", err: :close)
- return "N/A" unless $C... | true |
Other | Homebrew | brew | 32ad22395bddf3eda906b70c2b3d814e5af2a498.json | Remove some `#popen_read`s. | Library/Homebrew/readall.rb | @@ -73,21 +73,20 @@ def valid_tap?(tap, options = {})
private
def syntax_errors_or_warnings?(rb)
- # Retrieve messages about syntax errors/warnings printed to `$stderr`, but
- # discard a `Syntax OK` printed to `$stdout` (in absence of syntax errors).
- messages = Utils.popen_read("#{RUBY_PAT... | true |
Other | Homebrew | brew | 32ad22395bddf3eda906b70c2b3d814e5af2a498.json | Remove some `#popen_read`s. | Library/Homebrew/requirements/java_requirement.rb | @@ -122,7 +122,7 @@ def oracle_java_os
end
def satisfies_version(java)
- java_version_s = Utils.popen_read(java, "-version", err: :out)[/\d+.\d/]
+ java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+.\d/]
return false unless java_version_s
java_version = Ve... | true |
Other | Homebrew | brew | 32ad22395bddf3eda906b70c2b3d814e5af2a498.json | Remove some `#popen_read`s. | Library/Homebrew/system_command.rb | @@ -30,16 +30,16 @@ def self.run!(command, **options)
def run!
puts command.shelljoin.gsub(/\\=/, "=") if verbose? || ARGV.debug?
- @merged_output = []
+ @output = []
each_output_line do |type, line|
case type
when :stdout
$stdout << line if print_stdout?
- @merged_o... | true |
Other | Homebrew | brew | 32ad22395bddf3eda906b70c2b3d814e5af2a498.json | Remove some `#popen_read`s. | Library/Homebrew/system_config.rb | @@ -79,9 +79,9 @@ def kernel
def describe_java
return "N/A" unless which "java"
- java_version = Utils.popen_read("java", "-version")
- return "N/A" unless $CHILD_STATUS.success?
- java_version[/java version "([\d\._]+)"/, 1] || "N/A"
+ _, err, status = system_command("java", args: ["-... | true |
Other | Homebrew | brew | 32ad22395bddf3eda906b70c2b3d814e5af2a498.json | Remove some `#popen_read`s. | Library/Homebrew/test/cask/pkg_spec.rb | @@ -150,7 +150,7 @@
"/usr/sbin/pkgutil",
args: ["--pkg-info-plist", pkg_id],
).and_return(
- SystemCommand::Result.new(nil, pkg_info_plist, nil, instance_double(Process::Status, exitstatus: 0)),
+ SystemCommand::Result.new(nil, [[:stdout, pkg_info_plist]], instance_double(Process:... | true |
Other | Homebrew | brew | 32ad22395bddf3eda906b70c2b3d814e5af2a498.json | Remove some `#popen_read`s. | Library/Homebrew/test/java_requirement_spec.rb | @@ -55,7 +55,7 @@
def setup_java_with_version(version)
IO.write java, <<~SH
#!/bin/sh
- echo 'java version "#{version}"'
+ echo 'java version "#{version}"' 1>&2
SH
FileUtils.chmod "+x", java
end | true |
Other | Homebrew | brew | 32ad22395bddf3eda906b70c2b3d814e5af2a498.json | Remove some `#popen_read`s. | Library/Homebrew/test/support/helper/cask/fake_system_command.rb | @@ -52,7 +52,7 @@ def self.run(command_string, options = {})
if response.respond_to?(:call)
response.call(command_string, options)
else
- SystemCommand::Result.new(command, response, "", OpenStruct.new(exitstatus: 0))
+ SystemCommand::Result.new(command, [[:stdout, response]], OpenStruct.new(... | true |
Other | Homebrew | brew | 32ad22395bddf3eda906b70c2b3d814e5af2a498.json | Remove some `#popen_read`s. | Library/Homebrew/test/system_command_result_spec.rb | @@ -2,8 +2,14 @@
describe SystemCommand::Result do
describe "#to_ary" do
+ let(:output) {
+ [
+ [:stdout, "output"],
+ [:stderr, "error"],
+ ]
+ }
subject(:result) {
- described_class.new([], "output", "error", instance_double(Process::Status, exitstatus: 0, success?: true)... | true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/build.rb | @@ -190,7 +190,20 @@ def fixopt(f)
build = Build.new(formula, options)
build.install
rescue Exception => e # rubocop:disable Lint/RescueException
- Marshal.dump(e, error_pipe)
+ error_hash = JSON.parse e.to_json
+
+ # Special case: need to recreate BuildErrors in full
+ # for proper analytics reporting and... | true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/dev-cmd/test.rb | @@ -93,9 +93,6 @@ def test
exec(*args)
end
end
- rescue ::Test::Unit::AssertionFailedError => e
- ofail "#{f.full_name}: failed"
- puts e.message
rescue Exception => e # rubocop:disable Lint/RescueException
ofail "#{f.full_name}: failed"
puts ... | true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/exceptions.rb | @@ -352,14 +352,16 @@ def initialize(formula)
end
class BuildError < RuntimeError
- attr_reader :formula, :env
- attr_accessor :options
+ attr_reader :cmd, :args, :env
+ attr_accessor :formula, :options
def initialize(formula, cmd, args, env)
@formula = formula
+ @cmd = cmd
+ @args = args
@... | true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/formula_installer.rb | @@ -744,14 +744,18 @@ def build
raise "Empty installation"
end
rescue Exception => e # rubocop:disable Lint/RescueException
- e.options = display_options(formula) if e.is_a?(BuildError)
+ if e.is_a? BuildError
+ e.formula = formula
+ e.options = options
+ end
+
ignore_interrupts d... | true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/global.rb | @@ -1,5 +1,7 @@
require "pathname"
require "English"
+require "json"
+require "json/add/core"
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent
| true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/postinstall.rb | @@ -15,7 +15,7 @@
formula.extend(Debrew::Formula) if ARGV.debug?
formula.run_post_install
rescue Exception => e # rubocop:disable Lint/RescueException
- Marshal.dump(e, error_pipe)
+ error_pipe.puts e.to_json
error_pipe.close
exit! 1
end | true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/test.rb | @@ -28,7 +28,7 @@
raise "test returned false" if formula.run_test == false
end
rescue Exception => e # rubocop:disable Lint/RescueException
- Marshal.dump(e, error_pipe)
+ error_pipe.puts e.to_json
error_pipe.close
exit! 1
end | true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/test/formula_installer_spec.rb | @@ -4,6 +4,7 @@
require "tab"
require "test/support/fixtures/testball"
require "test/support/fixtures/testball_bottle"
+require "test/support/fixtures/failball"
describe FormulaInstaller do
define_negated_matcher :need_bottle, :be_bottle_unneeded
@@ -28,7 +29,7 @@ def temporary_install(formula)
Tab.clea... | true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/test/support/fixtures/failball.rb | @@ -0,0 +1,20 @@
+class Failball < Formula
+ def initialize(name = "failball", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil)
+ self.class.instance_eval do
+ stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
+ stable.sha256 TESTBALL_SHA256
+ end
+ super
+... | true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/test/support/lib/config.rb | @@ -8,7 +8,11 @@
TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k|
dir = Dir.mktmpdir("homebrew-tests-", ENV["HOMEBREW_TEMP"] || "/tmp")
- at_exit { FileUtils.remove_entry(dir) }
+ at_exit do
+ # Child processes inherit this at_exit handler, but we don't want them
+ # to clean TEST_TMPDIR up prematur... | true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/test/utils/fork_spec.rb | @@ -0,0 +1,21 @@
+require "utils/fork"
+
+describe Utils do
+ describe "#safe_fork" do
+ it "raises a RuntimeError on an error that isn't ErrorDuringExecution" do
+ expect {
+ described_class.safe_fork do
+ raise "this is an exception in the child"
+ end
+ }.to raise_error(RuntimeEr... | true |
Other | Homebrew | brew | 86b964745038eebff6218e97735e6344b6f3e42a.json | utils: Use JSON to marshal child errors
Replaces our serialization of child process
errors via Marshal with JSON, preventing
unintentional or malicious code execution outside
of the build sandbox.
Additionally, adds tests for the new behavior. | Library/Homebrew/utils/fork.rb | @@ -2,6 +2,26 @@
require "socket"
module Utils
+ def self.rewrite_child_error(child_error)
+ error = if child_error.inner_class == ErrorDuringExecution
+ ErrorDuringExecution.new(child_error.inner["cmd"],
+ status: child_error.inner["status"],
+ o... | true |
Other | Homebrew | brew | ec9e45a8f062cbd00ad9fdd64d4f3f35c5c578fd.json | tests: handle file leaks and SVN test prompt.
- Ignore files that are generated by `brew tests`
- Make the SVN tests work without prompting for GitHub's SSL certificate | .gitignore | @@ -18,6 +18,8 @@
/Library/Homebrew/test/bin
/Library/Homebrew/test/coverage
/Library/Homebrew/test/fs_leak_log
+/Library/Homebrew/test/.gem
+/Library/Homebrew/test/.subversion
/Library/Homebrew/tmp
/Library/Homebrew/.npmignore
/Library/LinkedKegs | true |
Other | Homebrew | brew | ec9e45a8f062cbd00ad9fdd64d4f3f35c5c578fd.json | tests: handle file leaks and SVN test prompt.
- Ignore files that are generated by `brew tests`
- Make the SVN tests work without prompting for GitHub's SSL certificate | Library/Homebrew/test/utils/svn_spec.rb | @@ -32,7 +32,9 @@
it "returns true when remote exists", :needs_network, :needs_svn do
HOMEBREW_CACHE.cd do
- system HOMEBREW_SHIMS_PATH/"scm/svn", "checkout", "https://github.com/Homebrew/install"
+ system HOMEBREW_SHIMS_PATH/"scm/svn", "checkout",
+ "--non-interactive", "... | true |
Other | Homebrew | brew | ec9e45a8f062cbd00ad9fdd64d4f3f35c5c578fd.json | tests: handle file leaks and SVN test prompt.
- Ignore files that are generated by `brew tests`
- Make the SVN tests work without prompting for GitHub's SSL certificate | Library/Homebrew/utils/svn.rb | @@ -10,6 +10,7 @@ def self.svn_available?
def self.svn_remote_exists?(url)
return true unless svn_available?
- quiet_system "svn", "ls", url, "--depth", "empty"
+ ssl_args = ["--non-interactive", "--trust-server-cert"] if ENV["HOMEBREW_TEST_ONLINE"]
+ quiet_system "svn", "ls", url, "--depth", "empty"... | true |
Other | Homebrew | brew | 9102c120bb0ab57added0ea60edcc160ce37e136.json | cleanup: fix go_cache cleanup | Library/Homebrew/cleanup.rb | @@ -39,6 +39,12 @@ def nested_cache?
directory? && %w[go_cache glide_home java_cache npm_cache gclient_cache].include?(basename.to_s)
end
+ def go_cache_directory?
+ # Go makes its cache contents read-only to ensure cache integrity,
+ # which makes sense but is something we need to undo for c... | false |
Other | Homebrew | brew | b54682f7091724fee2537b25a2dcc4d084d6a773.json | Avoid network call in `#initialize`. | Library/Homebrew/download_strategy.rb | @@ -188,11 +188,8 @@ def extract_ref(specs)
end
class AbstractFileDownloadStrategy < AbstractDownloadStrategy
- attr_reader :temporary_path
-
- def initialize(url, name, version, **meta)
- super
- @temporary_path = Pathname.new("#{cached_location}.incomplete")
+ def temporary_path
+ @temporary_path ||= ... | false |
Other | Homebrew | brew | ae18bdf1619103ab6a5b78d94df9c150ae8e0f03.json | Skip `mtime` for non-existent symlink. | Library/Homebrew/cleanup.rb | @@ -43,6 +43,8 @@ def prune?(days)
return false unless days
return true if days.zero?
+ return true if symlink? && !exist?
+
# TODO: Replace with ActiveSupport's `.days.ago`.
mtime < ((@time ||= Time.now) - days * 60 * 60 * 24)
end | false |
Other | Homebrew | brew | 9b50fd81d729080b746b9637ad3a0c59049b96a3.json | Move everything into one file. | Library/Homebrew/update_migrator.rb | @@ -1,39 +1,374 @@
-require "update_migrator/cache_entries_to_double_dashes"
-require "update_migrator/cache_entries_to_symlinks"
-require "update_migrator/legacy_cache"
-require "update_migrator/legacy_keg_symlinks"
-require "update_migrator/legacy_repository"
+require "hbc/cask_loader"
+require "hbc/download"
modu... | true |
Other | Homebrew | brew | 9b50fd81d729080b746b9637ad3a0c59049b96a3.json | Move everything into one file. | Library/Homebrew/update_migrator/cache_entries_to_double_dashes.rb | @@ -1,41 +0,0 @@
-module UpdateMigrator
- module_function
-
- def migrate_cache_entries_to_double_dashes(initial_version)
- return if initial_version && initial_version > "1.7.1"
-
- return if ENV.key?("HOMEBREW_DISABLE_LOAD_FORMULA")
-
- ohai "Migrating cache entries..."
-
- Formula.each do |formula|
- ... | true |
Other | Homebrew | brew | 9b50fd81d729080b746b9637ad3a0c59049b96a3.json | Move everything into one file. | Library/Homebrew/update_migrator/cache_entries_to_symlinks.rb | @@ -1,91 +0,0 @@
-require "hbc/cask_loader"
-require "hbc/download"
-
-module UpdateMigrator
- module_function
-
- def migrate_cache_entries_to_symlinks(initial_version)
- return if initial_version && initial_version > "1.7.2"
-
- return if ENV.key?("HOMEBREW_DISABLE_LOAD_FORMULA")
-
- ohai "Migrating cache ... | true |
Other | Homebrew | brew | 9b50fd81d729080b746b9637ad3a0c59049b96a3.json | Move everything into one file. | Library/Homebrew/update_migrator/legacy_cache.rb | @@ -1,53 +0,0 @@
-module UpdateMigrator
- module_function
-
- def migrate_legacy_cache_if_necessary
- legacy_cache = Pathname.new "/Library/Caches/Homebrew"
- return if HOMEBREW_CACHE.to_s == legacy_cache.to_s
- return unless legacy_cache.directory?
- return unless legacy_cache.readable_real?
-
- migra... | true |
Other | Homebrew | brew | 9b50fd81d729080b746b9637ad3a0c59049b96a3.json | Move everything into one file. | Library/Homebrew/update_migrator/legacy_keg_symlinks.rb | @@ -1,42 +0,0 @@
-module UpdateMigrator
- module_function
-
- def migrate_legacy_keg_symlinks_if_necessary
- legacy_linked_kegs = HOMEBREW_LIBRARY/"LinkedKegs"
- return unless legacy_linked_kegs.directory?
-
- HOMEBREW_LINKED_KEGS.mkpath unless legacy_linked_kegs.children.empty?
- legacy_linked_kegs.child... | true |
Other | Homebrew | brew | 9b50fd81d729080b746b9637ad3a0c59049b96a3.json | Move everything into one file. | Library/Homebrew/update_migrator/legacy_repository.rb | @@ -1,122 +0,0 @@
-module UpdateMigrator
- module_function
-
- def migrate_legacy_repository_if_necessary
- return unless HOMEBREW_PREFIX.to_s == "/usr/local"
- return unless HOMEBREW_REPOSITORY.to_s == "/usr/local"
-
- ohai "Migrating HOMEBREW_REPOSITORY (please wait)..."
-
- unless HOMEBREW_PREFIX.writa... | true |
Other | Homebrew | brew | 443111896e71f394a19047caf6ac9e0e8e2e9b4d.json | Share common logic. | Library/Homebrew/update_migrator/cache_entries_to_symlinks.rb | @@ -11,6 +11,18 @@ def migrate_cache_entries_to_symlinks(initial_version)
ohai "Migrating cache entries..."
+ cache_entries = lambda do |path|
+ if path.directory?
+ path.children
+ .reject(&:symlink?)
+ .select(&:file?)
+ .map { |child| child.basename.to_s.sub(/... | false |
Other | Homebrew | brew | ccf396887a283595affef49d8a1e445f45fecf06.json | Add comment about refinement scope. | Library/Homebrew/cleanup.rb | @@ -213,6 +213,7 @@ def cleanup_unreferenced_downloads
return if dry_run?
return unless (cache/"downloads").directory?
+ # We can't use `.reject(&:incomplete?) here due to the refinement scope.
downloads = (cache/"downloads").children.reject { |path| path.incomplete? } # rubocop:disable Styl... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.