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

Are all of the undefs we use really necessary? #17998

Closed
1 of 29 tasks
issyl0 opened this issue Aug 9, 2024 · 34 comments
Closed
1 of 29 tasks

Are all of the undefs we use really necessary? #17998

issyl0 opened this issue Aug 9, 2024 · 34 comments
Assignees
Labels
features New features stale No recent activity

Comments

@issyl0
Copy link
Member

issyl0 commented Aug 9, 2024

Verification

Provide a detailed description of the proposed feature

As part of the Sorbet work, I went through and commented every file that uses undef so that others don't waste their time trying to make it typed: strict (because Sorbet doesn't support undef).

Carlo commented, wisely, that maybe we don't need to have the undefs anymore.

We should investigate this and remove any unnecessary undefs. Or find a Sorbet-compatible way.

The files are:

  • Library/Homebrew/cli/args.rb
  • Library/Homebrew/dev-cmd/extract.rb
  • Library/Homebrew/extend/os/linux/cleanup.rb
  • Library/Homebrew/extend/os/linux/dependency_collector.rb
  • Library/Homebrew/extend/os/linux/diagnostic.rb
  • Library/Homebrew/extend/os/linux/formula.rb
  • Library/Homebrew/extend/os/linux/formula_installer.rb
  • Library/Homebrew/extend/os/linux/keg.rb
  • Library/Homebrew/extend/os/linux/parser.rb
  • Library/Homebrew/extend/os/linux/simulate_system.rb
  • Library/Homebrew/extend/os/mac/cleaner.rb
  • Library/Homebrew/extend/os/mac/cleanup.rb
  • Library/Homebrew/extend/os/mac/dependency_collector.rb
  • Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb
  • Library/Homebrew/extend/os/mac/development_tools.rb
  • Library/Homebrew/extend/os/mac/diagnostic.rb
  • Library/Homebrew/extend/os/mac/extend/ENV/std.rb
  • Library/Homebrew/extend/os/mac/extend/ENV/super.rb
  • Library/Homebrew/extend/os/mac/formula.rb
  • Library/Homebrew/extend/os/mac/formula_installer.rb
  • Library/Homebrew/extend/os/mac/hardware/cpu.rb
  • Library/Homebrew/extend/os/mac/keg.rb
  • Library/Homebrew/extend/os/mac/keg_relocate.rb
  • Library/Homebrew/extend/os/mac/linkage_checker.rb
  • Library/Homebrew/extend/os/mac/readall.rb
  • Library/Homebrew/extend/os/mac/simulate_system.rb
  • Library/Homebrew/extend/os/mac/system_config.rb
  • Library/Homebrew/ignorable.rb

What is the motivation for the feature?

Reducing unnecessary code. Improving Sorbet coverage eventually maybe.

How will the feature be relevant to at least 90% of Homebrew users?

It won't be.

What alternatives to the feature have been considered?

Keeping them even though they may not be needed.

@issyl0 issyl0 added the features New features label Aug 9, 2024
@MikeMcQuaid
Copy link
Member

MikeMcQuaid commented Aug 9, 2024

Change the value of HOMEBREW_RUBY_WARNINGS to (I can't remember which) -W2 or -W0.

The undef are/were necessary because we're redefining methods which produced/produce warnings.

There was a previous goal to get rid of these warnings.

@issyl0
Copy link
Member Author

issyl0 commented Aug 9, 2024

You answered a question I didn't even know I had (yet): how do I actually check for these being unused. Thanks!

@MikeMcQuaid
Copy link
Member

$ HOMEBREW_RUBY_WARNINGS="-W2" brew info wget
/opt/homebrew/Library/Homebrew/extend/os/mac/hardware/cpu.rb:38: warning: method redefined; discarding old in_rosetta2?
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of in_rosetta2? was here
/opt/homebrew/Library/Homebrew/extend/os/mac/hardware/cpu.rb:92: warning: method redefined; discarding old virtualized?
/opt/homebrew/Library/Homebrew/hardware.rb:163: warning: previous definition of virtualized? was here
/opt/homebrew/Library/Homebrew/extend/pathname.rb:235: warning: method redefined; discarding old extname
/opt/homebrew/Library/Homebrew/extend/pathname.rb:507: warning: method redefined; discarding old rmtree
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/pathname.rb:598: warning: previous definition of rmtree was here
<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/cli/parser.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:50:in  `<main>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cli/parser.rb:4:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/abstract_command.rb:4:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

/opt/homebrew/Library/Homebrew/extend/os/mac/development_tools.rb:64: warning: method redefined; discarding old installation_instructions
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of installation_instructions was here
/opt/homebrew/Library/Homebrew/extend/os/mac/development_tools.rb:69: warning: method redefined; discarding old custom_installation_instructions
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of custom_installation_instructions was here
<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/cask/cask_loader.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:65:in  `<main>'
	from /opt/homebrew/Library/Homebrew/commands.rb:37:in  `valid_internal_cmd?'
	from /opt/homebrew/Library/Homebrew/extend/kernel.rb:11:in  `require?'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cmd/info.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:6:in  `<top (required)>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:8:in  `<module:Homebrew>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:9:in  `<module:MissingFormula>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:198:in  `singleton class'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/os/missing_formula.rb:4:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/os/mac/missing_formula.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cask/cask_loader.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cask/cask.rb:6:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/cask/cask.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:65:in  `<main>'
	from /opt/homebrew/Library/Homebrew/commands.rb:37:in  `valid_internal_cmd?'
	from /opt/homebrew/Library/Homebrew/extend/kernel.rb:11:in  `require?'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cmd/info.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:6:in  `<top (required)>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:8:in  `<module:Homebrew>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:9:in  `<module:MissingFormula>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:198:in  `singleton class'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/os/missing_formula.rb:4:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/os/mac/missing_formula.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cask/cask_loader.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cask/cask.rb:8:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cask/dsl.rb:7:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/livecheck.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

/opt/homebrew/Library/Homebrew/extend/os/mac/missing_formula.rb:24: warning: method redefined; discarding old cask_reason
/opt/homebrew/Library/Homebrew/missing_formula.rb:194: warning: previous definition of cask_reason was here
/opt/homebrew/Library/Homebrew/extend/os/mac/missing_formula.rb:31: warning: method redefined; discarding old suggest_command
/opt/homebrew/Library/Homebrew/missing_formula.rb:196: warning: previous definition of suggest_command was here
/opt/homebrew/Library/Homebrew/extend/os/mac/formula_support.rb:6: warning: method redefined; discarding old applicable?
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of applicable? was here
/opt/homebrew/Library/Homebrew/extend/os/mac/keg.rb:33: warning: method redefined; discarding old codesign_patched_binary
/opt/homebrew/Library/Homebrew/keg.rb:548: warning: previous definition of codesign_patched_binary was here
<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/formula.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:65:in  `<main>'
	from /opt/homebrew/Library/Homebrew/commands.rb:37:in  `valid_internal_cmd?'
	from /opt/homebrew/Library/Homebrew/extend/kernel.rb:11:in  `require?'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cmd/info.rb:8:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/formula.rb:28:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/linkage_checker.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/formula.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:65:in  `<main>'
	from /opt/homebrew/Library/Homebrew/commands.rb:37:in  `valid_internal_cmd?'
	from /opt/homebrew/Library/Homebrew/extend/kernel.rb:11:in  `require?'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cmd/info.rb:8:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/formula.rb:29:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/ENV.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/diagnostic.rb:6:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/extend/ENV.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:65:in  `<main>'
	from /opt/homebrew/Library/Homebrew/commands.rb:37:in  `valid_internal_cmd?'
	from /opt/homebrew/Library/Homebrew/extend/kernel.rb:11:in  `require?'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cmd/info.rb:8:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/formula.rb:29:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/ENV.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/diagnostic.rb:11:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/system_config.rb:7:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

/opt/homebrew/Library/Homebrew/extend/os/mac/system_config.rb:32: warning: method redefined; discarding old core_tap_config
/opt/homebrew/Library/Homebrew/system_config.rb:136: warning: previous definition of core_tap_config was here
/opt/homebrew/Library/Homebrew/extend/os/mac/extend/ENV/super.rb:7: warning: method redefined; discarding old shims_path
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of shims_path was here
/opt/homebrew/Library/Homebrew/extend/os/mac/language/java.rb:6: warning: method redefined; discarding old java_home
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of java_home was here
==> wget: stable 1.24.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
Installed
/opt/homebrew/Cellar/wget/1.24.5 (92 files, 4.5MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-07-04 at 10:26:26
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/w/wget.rb
License: GPL-3.0-or-later
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl@3 ✔, gettext ✔, libunistring ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 74,368 (30 days), 265,276 (90 days), 1,001,763 (365 days)
install-on-request: 74,218 (30 days), 264,636 (90 days), 999,749 (365 days)
build-error: 9 (30 days)
mikebook # HOMEBREW_RUBY_WARNINGS="-W2" brew info wget
/opt/homebrew/Library/Homebrew/extend/os/mac/hardware/cpu.rb:38: warning: method redefined; discarding old in_rosetta2?
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of in_rosetta2? was here
/opt/homebrew/Library/Homebrew/extend/os/mac/hardware/cpu.rb:92: warning: method redefined; discarding old virtualized?
/opt/homebrew/Library/Homebrew/hardware.rb:163: warning: previous definition of virtualized? was here
/opt/homebrew/Library/Homebrew/extend/pathname.rb:235: warning: method redefined; discarding old extname
/opt/homebrew/Library/Homebrew/extend/pathname.rb:507: warning: method redefined; discarding old rmtree
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/pathname.rb:598: warning: previous definition of rmtree was here
<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/cli/parser.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:50:in  `<main>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cli/parser.rb:4:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/abstract_command.rb:4:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

/opt/homebrew/Library/Homebrew/extend/os/mac/development_tools.rb:64: warning: method redefined; discarding old installation_instructions
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of installation_instructions was here
/opt/homebrew/Library/Homebrew/extend/os/mac/development_tools.rb:69: warning: method redefined; discarding old custom_installation_instructions
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of custom_installation_instructions was here
<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/cask/cask_loader.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:65:in  `<main>'
	from /opt/homebrew/Library/Homebrew/commands.rb:37:in  `valid_internal_cmd?'
	from /opt/homebrew/Library/Homebrew/extend/kernel.rb:11:in  `require?'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cmd/info.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:6:in  `<top (required)>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:8:in  `<module:Homebrew>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:9:in  `<module:MissingFormula>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:198:in  `singleton class'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/os/missing_formula.rb:4:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/os/mac/missing_formula.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cask/cask_loader.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cask/cask.rb:6:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/cask/cask.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:65:in  `<main>'
	from /opt/homebrew/Library/Homebrew/commands.rb:37:in  `valid_internal_cmd?'
	from /opt/homebrew/Library/Homebrew/extend/kernel.rb:11:in  `require?'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cmd/info.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:6:in  `<top (required)>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:8:in  `<module:Homebrew>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:9:in  `<module:MissingFormula>'
	from /opt/homebrew/Library/Homebrew/missing_formula.rb:198:in  `singleton class'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/os/missing_formula.rb:4:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/os/mac/missing_formula.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cask/cask_loader.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cask/cask.rb:8:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cask/dsl.rb:7:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/livecheck.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

/opt/homebrew/Library/Homebrew/extend/os/mac/missing_formula.rb:24: warning: method redefined; discarding old cask_reason
/opt/homebrew/Library/Homebrew/missing_formula.rb:194: warning: previous definition of cask_reason was here
/opt/homebrew/Library/Homebrew/extend/os/mac/missing_formula.rb:31: warning: method redefined; discarding old suggest_command
/opt/homebrew/Library/Homebrew/missing_formula.rb:196: warning: previous definition of suggest_command was here
/opt/homebrew/Library/Homebrew/extend/os/mac/formula_support.rb:6: warning: method redefined; discarding old applicable?
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of applicable? was here
/opt/homebrew/Library/Homebrew/extend/os/mac/keg.rb:33: warning: method redefined; discarding old codesign_patched_binary
/opt/homebrew/Library/Homebrew/keg.rb:548: warning: previous definition of codesign_patched_binary was here
<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/formula.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:65:in  `<main>'
	from /opt/homebrew/Library/Homebrew/commands.rb:37:in  `valid_internal_cmd?'
	from /opt/homebrew/Library/Homebrew/extend/kernel.rb:11:in  `require?'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cmd/info.rb:8:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/formula.rb:28:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/linkage_checker.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/formula.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:65:in  `<main>'
	from /opt/homebrew/Library/Homebrew/commands.rb:37:in  `valid_internal_cmd?'
	from /opt/homebrew/Library/Homebrew/extend/kernel.rb:11:in  `require?'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cmd/info.rb:8:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/formula.rb:29:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/ENV.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/diagnostic.rb:6:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

<internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37: warning: loading in progress, circular require considered harmful - /opt/homebrew/Library/Homebrew/extend/ENV.rb
	from /opt/homebrew/Library/Homebrew/brew.rb:65:in  `<main>'
	from /opt/homebrew/Library/Homebrew/commands.rb:37:in  `valid_internal_cmd?'
	from /opt/homebrew/Library/Homebrew/extend/kernel.rb:11:in  `require?'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/cmd/info.rb:8:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/formula.rb:29:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/extend/ENV.rb:5:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/diagnostic.rb:11:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from /opt/homebrew/Library/Homebrew/system_config.rb:7:in  `<top (required)>'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'
	from <internal:/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in  `require'

/opt/homebrew/Library/Homebrew/extend/os/mac/system_config.rb:32: warning: method redefined; discarding old core_tap_config
/opt/homebrew/Library/Homebrew/system_config.rb:136: warning: previous definition of core_tap_config was here
/opt/homebrew/Library/Homebrew/extend/os/mac/extend/ENV/super.rb:7: warning: method redefined; discarding old shims_path
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of shims_path was here
/opt/homebrew/Library/Homebrew/extend/os/mac/language/java.rb:6: warning: method redefined; discarding old java_home
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11514/lib/types/private/methods/_methods.rb:257: warning: previous definition of java_home was here
==> wget: stable 1.24.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
Installed
/opt/homebrew/Cellar/wget/1.24.5 (92 files, 4.5MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-07-04 at 10:26:26
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/w/wget.rb
License: GPL-3.0-or-later
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl@3 ✔, gettext ✔, libunistring ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 74,368 (30 days), 265,276 (90 days), 1,001,763 (365 days)
install-on-request: 74,218 (30 days), 264,636 (90 days), 999,749 (365 days)
build-error: 9 (30 days)

@MikeMcQuaid
Copy link
Member

It's unclear to me what the "right"/Sorbet-friendly way to do this is. CC @dduugg for thoughts.

@carlocab
Copy link
Member

carlocab commented Aug 9, 2024

Here's how Sorbet deals with it:

sorbet/sorbet#1150
sorbet/sorbet#1266

@dduugg
Copy link
Member

dduugg commented Aug 9, 2024

I'm so honored someone asked! I haven't been a fan of how we do OS-specific code, and I would be curious to hear about how we landed there. (I wasted hours in confusion before I caught on, not realizing that methods may be dynamically redefined based on the OS.)

Using Cleaner as an example, how do folks feel about something like this? (It's a breaking change, but it could be written in a backward-compatible manner).

Also, is there a reason we're reluctant to do OS checks within methods? Feels like an over-optimization to avoid them (it should be plenty fast, though we should be able to cache the result). This seems ~fine to me:

sig { params(path: Pathname).returns(T::Boolean) }
def executable_path?(path)
  if OS.mac?
    path.mach_o_executable? || path.text_executable?
  elsif OS.linux?
    path.elf? || path.text_executable?
  else
    path.text_executable? || path.executable?
  end
end

@dduugg
Copy link
Member

dduugg commented Aug 9, 2024

Also, I'm a bit reluctant to mention this option, but since the sorbet error is well-scoped, we could suppress it in the sorbet config. (Sorbet won't delete the method from its model, which is ~fine, as we use it to replace defs.)

@carlocab
Copy link
Member

Using Cleaner as an example, how do folks feel about something like this? (It's a breaking change, but it could be written in a backward-compatible manner).

I'd be game to try something like this.

Also, is there a reason we're reluctant to do OS checks within methods?

I think the reason has to do with readability -- littering OS.mac? or OS.linux? all over the place can make the code unreadable. The existing way we handle OS-specific code is a bit like enforcing that you only get to call either of OS.mac? or OS.linux? once in any given method.

I haven't been a fan of how we do OS-specific code, and I would be curious to hear about how we landed there. (I wasted hours in confusion before I caught on, not realizing that methods may be dynamically redefined based on the OS.)

I'm a bit sympathetic to this. I think moving OS-specific code into separate files makes these methods harder to reason about (since you now need to have multiple files open to do this), and there was definitely a point where I had the same confusion you did. It also makes the source displayed on rubydoc.brew.sh pretty useless for some methods (example).

@apainintheneck
Copy link
Contributor

I'm not that big a fan of the existing platform-specific code organization approach either but I'm not aware of any better approaches. I wonder if it'd make sense to add some developer documentation about it so that it's more obvious for new contributors how it works assuming it doesn't already exist somewhere.

@Bo98
Copy link
Member

Bo98 commented Aug 10, 2024

Using Cleaner as an example, how do folks feel about something like this? (It's a breaking change, but it could be written in a backward-compatible manner)

Am OK changing up the way things are but I'm not particularly a fan of a factory approach in Ruby.

@MikeMcQuaid
Copy link
Member

I haven't been a fan of how we do OS-specific code, and I would be curious to hear about how we landed there.

I did much of the original cross-platform work in Homebrew/brew and decided on the approach that would be landed in Homebrew/brew when Linuxbrew merged in.

This was based on my work across several other open source projects and ~4 companies building and maintaining cross-platform software in a way that was maintainable in the longer-term.

Also, is there a reason we're reluctant to do OS checks within methods? Feels like an over-optimization to avoid them (it should be plenty fast, though we should be able to cache the result).

Yes:

I think the reason has to do with readability -- littering OS.mac? or OS.linux? all over the place can make the code unreadable. The existing way we handle OS-specific code is a bit like enforcing that you only get to call either of OS.mac? or OS.linux? once in any given method.

This is part of it. Another part of it is, if you're porting to a new OS in future (this is not hypothetical, I have an email in my inbox asking about porting Homebrew to Windows so this is timely 😁): being able to relatively easy tell "which parts of Homebrew already require cross-platform code" rather than "grep for OS.linux?/OS.mac? everywhere" is a much nicer solution.

I think moving OS-specific code into separate files makes these methods harder to reason about (since you now need to have multiple files open to do this), and there was definitely a point where I had the same confusion you did.

It also makes the source displayed on rubydoc.brew.sh pretty useless for some methods (example).

This would be good to address in RubyDoc. I don't think adjusting the code to improve the generated documentation makes sense.

Am OK changing up the way things are but I'm not particularly a fan of a factory approach in Ruby.

Same here. I strongly dislike it, sorry.

I would be game for something that maintains the file separation we have today while avoiding the need to undef as we do today.

I would ideally like us to lean harder into this approach and have fewer still/no OS.mac? or OS.linux? checks (or Homebrew::SimulateSystem.simulating_or_running_on_macos? or Homebrew::SimulateSystem.simulating_or_running_on_linux? checks which have sadly broken some of above rules) so that we can get a better indication still of what code is run on macOS, Linux, both, neither (the "generic" layer) by looking at the names of the code rather than having to look for specific if calls.

I wonder if it'd make sense to add some developer documentation about it so that it's more obvious for new contributors how it works assuming it doesn't already exist somewhere.

I'm game to do this if someone can suggest where they'd expect to find said documentation.

A "cross-platform code" section in docs.brew.sh for "Contributors"?

@MikeMcQuaid
Copy link
Member

Here's how Sorbet deals with it:

sorbet/sorbet#1150 sorbet/sorbet#1266

For this specific undef case: I think this is a clever solution that'd be nice for us to adopt. Feels like it'd be easy enough to have our own (better) DSLs here rather than manually calling undef all over the place.

Also, I'm a bit reluctant to mention this option, but since the sorbet error is well-scoped, we could suppress it in the sorbet config. (Sorbet won't delete the method from its model, which is ~fine, as we use it to replace defs.)

This also seems like a good option for us to progress with Sorbet strict usage. It'd be a shame to be blocked on making progress on Sorbet strict additions to requiring us to resolve how we use undef.

@dduugg
Copy link
Member

dduugg commented Aug 13, 2024

I'm game to do this if someone can suggest where they'd expect to find said documentation.

A "cross-platform code" section in docs.brew.sh for "Contributors"?

I don't imagine this to be helpful, if it's a general "methods may be redefined in extend/os" disclaimer. A standard warning colocated with redefined code would be my preference. A custom YARD tag (e.g. @redefined_in_extend_os) could be a possibility.

@MikeMcQuaid
Copy link
Member

I don't imagine this to be helpful, if it's a general "methods may be redefined in extend/os" disclaimer.

My thinking was more that this documentation would explain how we separate code by OSs and why to ease people doing either Homebrew/brew platform work or porting to a new platform.

Another undef-avoiding option would be that we move the "generic" layer to os/extend/generic and we have these methods actually undefined in the original classes.

Similarly, we could use include SomeClassLinuxModule instead of reopening the class elsewhere.

I'm open to ideas, I just mainly want to avoid:

  • scattering more if/else all over the place
  • putting all definitions for all OSs in the same file(s) rather than in their own directory structures

@dduugg
Copy link
Member

dduugg commented Aug 14, 2024

My thinking was more that this documentation would explain how we separate code by OSs and why to ease people doing either Homebrew/brew platform work or porting to a new platform.

Agreed, personally I love (/feel reassured) when reading how technical decisions were thought out and considered.

Similarly, we could use include SomeClassLinuxModule instead of reopening the class elsewhere.

I think this is a very promising approach! (prepend might make more sense here, though that's getting into the weeds a bit…)

@MikeMcQuaid
Copy link
Member

I think this is a very promising approach! (prepend might make more sense here, though that's getting into the weeds a bit…)

To be clear: I'm not personally planning on rolling out this approach any time soon but someone in this thread who feels strongly should do so 😁.

To unblock things for now (CC @issyl0!), I'd like to strongly suggest we either do:

Also, I'm a bit reluctant to mention this option, but since the sorbet error is well-scoped, we could suppress it in the sorbet config. (Sorbet won't delete the method from its model, which is ~fine, as we use it to replace defs.)

or, which I'd now be fine with: just remove these undef because the Sorbet work is clearly higher priority than the "be able to run Homebrew one day at a higher level of warnings" work.

@dduugg
Copy link
Member

dduugg commented Aug 15, 2024

As of #18056 we suppress type errors caused by using undef at typed: strict.

Here is a draft of using prepended modules rather than undef for OS extensions (using Cleaner, arbitrarily). It passes typecheck/style/tests.

Note that sorbet has limited support for prepend, although it seems to be a popular request:

sorbet/sorbet#259
sorbet/sorbet#5025

@dduugg
Copy link
Member

dduugg commented Aug 15, 2024

Gah, #18056 doesn't work like I had hoped.

You can see that https://github.com/Homebrew/brew/blob/70b072a/Library/Homebrew/extend/os/mac/readall.rb is marked typed: strict now, but the sole method defined therein (valid_casks?) lacks a sig. Static sorbet typechecking can still identify type errors (it uses the original, undefined sig), but sorbet-runtime cannot.

I was somewhat indifferent to the prepend approach in the previous comment (it still has some discoverability issues IMO), but it does not suffer from this specific bug.

@carlocab
Copy link
Member

Should probably just remove the undefs instead of doing

--suppress-error-code=3008

@Bo98
Copy link
Member

Bo98 commented Aug 15, 2024

I don't think undef has anything to do with that runtime behaviour - the behaviour is identical without it.

@Bo98
Copy link
Member

Bo98 commented Aug 15, 2024

I was somewhat indifferent to the prepend approach in the previous comment (it still has some discoverability issues IMO), but it does not suffer from this specific bug.

Does it?

module A
  def f(x)
    p "no error"
  end
end

class B
  sig { params(x: Integer).void }
  def f(x)
    p x
  end
end

B.prepend(A)

B.new.f("ABC")
=> no error

It also doesn't work at all for class methods - I think that would require splitting further.

@dduugg
Copy link
Member

dduugg commented Aug 15, 2024

I don't think undef has anything to do with that runtime behaviour - the behaviour is identical without it.

Correct, tbc it's due to defining the same method multiple times within the same namespace. Sorbet is happy at strict if just one definition has a sig, but sorbet-runtime needs a sig each time to work.

@dduugg
Copy link
Member

dduugg commented Aug 15, 2024

I was somewhat indifferent to the prepend approach in the previous comment (it still has some discoverability issues IMO), but it does not suffer from this specific bug.

Does it?

module A
  def f(x)
    p "no error"
  end
end

class B
  sig { params(x: Integer).void }
  def f(x)
    p x
  end
end

B.prepend(A)

B.new.f("ABC")
=> no error

It also doesn't work at all for class methods - I think that would require splitting further.

Sorry, that isn't quite my bug report. If module A is in a typed: strict file, your example would require a sig for the A#f office. A sig is not required if it redefines B#f.

@Bo98
Copy link
Member

Bo98 commented Aug 15, 2024

@dduugg
Copy link
Member

dduugg commented Aug 16, 2024

It occurs to me that if a generic-OS path existed, it would solve the discoverability issue for me, as well as the undef problem. Has that approach been considered? PoC: https://github.com/Homebrew/brew/compare/cleaner-interface?expand=1

It:

  • Maintains separation of OS-specific code
  • Enforces sigs (and thus arity-checks) by using an interface
  • Avoids undef
  • Avoids prepend

It still suffers from the issue that signatures are not enforced in every OS extension file, even at typed: strict. That could be solved by defining modules (e.g. CleanerLinux) in the OS-specific paths that are then included in Cleaner, e.g.

# Library/Homebrew/extend/os/linux/cleaner.rb
module CleanerLinux
  include CleanerOS

  private

  sig { override.params(path: Pathname).returns(T::Boolean) }
  def executable_path?(path)
    path.elf? || path.text_executable?
  end
end

class Cleaner
  include CleanerOS
end

(Sorry for throwing so many approaches onto this thread, though it's helping me understand what coding styles are aligned with Homebrew. Folks in the sorbet Slack may find a more definitive answer there…)

@MikeMcQuaid
Copy link
Member

It occurs to me that if a generic-OS path existed

It does already. Run brew tests --generic which exercises this 😁

Has that approach been considered? PoC: cleaner-interface?expand=1 (compare)

I like this approach more than others suggested above and mostly more than what exists already. It'd be nice to be able to reduce the boilerplate there a little, if at all possible but not a blocker, but I agree having the method defined just in the else case feels nicer.

It still suffers from the issue that signatures are not enforced in every OS extension file, even at typed: strict. That could be solved by defining modules (e.g. CleanerLinux) in the OS-specific paths that are then included in Cleaner, e.g.

I like this even more, nice work.

Sorry for throwing so many approaches onto this thread, though it's helping me understand what coding styles are aligned with Homebrew.

No, it's good. More ideas means we get a better end result!

@dduugg
Copy link
Member

dduugg commented Sep 20, 2024

Are we good to close this, now that we have an approach from #18305 ?
Or should we wait until all the undefs are gone?

@MikeMcQuaid
Copy link
Member

Or should we wait until all the undefs are gone?

I think it'd be good to wait for this. After that, I think it'd be good to have:

A "cross-platform code" section in docs.brew.sh for "Contributors"?

Based on the format we've decided and used consistently.

@dduugg
Copy link
Member

dduugg commented Sep 23, 2024

👍

This is mostly resolved with #18378 (which I may chunk into smaller pieces) with the exceptions of:
Library/Homebrew/dev-cmd/extract.
Library/Homebrew/ignorable.rb
…which the approach in that PR doesn't generalize to, and are up for grabs.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Oct 15, 2024
@apainintheneck
Copy link
Contributor

There doesn't seem to be an obvious way to remove the remaining undef usages throughout the codebase so maybe we can close this. It might be nice to add a linter rule to prevent undef from being used in new code as well if something like that doesn't already exist.

@github-actions github-actions bot removed the stale No recent activity label Oct 15, 2024
@issyl0
Copy link
Member Author

issyl0 commented Oct 15, 2024

A linter rule, you say? My favourite!

Copy link

github-actions bot commented Nov 6, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Nov 6, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
features New features stale No recent activity
Projects
None yet
Development

No branches or pull requests

6 participants