Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
40.77k stars 9.57k forks source link

Are all of the `undef`s we use really necessary? #17998

Open issyl0 opened 1 month ago

issyl0 commented 1 month ago

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:

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.

MikeMcQuaid commented 1 month ago

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 commented 1 month ago

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

MikeMcQuaid commented 1 month ago
$ 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 commented 1 month ago

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

carlocab commented 1 month ago

Here's how Sorbet deals with it:

https://github.com/sorbet/sorbet/issues/1150 https://github.com/sorbet/sorbet/pull/1266

dduugg commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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:

dduugg commented 1 month ago

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 commented 4 weeks ago

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 commented 4 weeks ago

As of https://github.com/Homebrew/brew/pull/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:

https://github.com/sorbet/sorbet/issues/259 https://github.com/sorbet/sorbet/issues/5025

dduugg commented 4 weeks ago

Gah, https://github.com/Homebrew/brew/pull/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 commented 4 weeks ago

Should probably just remove the undefs instead of doing

https://github.com/Homebrew/brew/blob/fc8b80accf7c655829b26fa6e42f41e361ac7b31/Library/Homebrew/sorbet/config#L7

Bo98 commented 4 weeks ago

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

Bo98 commented 4 weeks ago

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 commented 4 weeks ago

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 commented 4 weeks ago

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 commented 4 weeks ago

Ah, gotcha. Though it does however lose the ability for arity checking:

https://sorbet.run/#%23%20typed%3A%20strong%0A%0Amodule%20A%0A%20%20extend%20T%3A%3ASig%0A%0A%20%20sig%20%7B%20params%28x%3A%20String%2C%20y%3A%20String%29.void%20%7D%0A%20%20def%20f%28x%2C%20y%29%0A%20%20%20%20%22uh%20oh%22%0A%20%20end%0Aend%0A%0Aclass%20B%0A%20%20extend%20T%3A%3ASig%0A%0A%20%20sig%20%7B%20params%28x%3A%20Integer%29.void%20%7D%0A%20%20def%20f%28x%29%0A%20%20%20%20p%20x%0A%20%20end%0Aend%0A%0AB.prepend%28A%29%0A%0AB.new.f%281%29%0A

Method redefinitions at least checked that behaviour. Not sure how to best to get that back to get the best of both.

I do generally agree though that something like prepend makes sense if we can get it right.

dduugg commented 4 weeks ago

Ah, gotcha. Though it does however lose the ability for arity checking:

https://sorbet.run/#%23%20typed%3A%20strong%0A%0Amodule%20A%0A%20%20extend%20T%3A%3ASig%0A%0A%20%20sig%20%7B%20params%28x%3A%20String%2C%20y%3A%20String%29.void%20%7D%0A%20%20def%20f%28x%2C%20y%29%0A%20%20%20%20%22uh%20oh%22%0A%20%20end%0Aend%0A%0Aclass%20B%0A%20%20extend%20T%3A%3ASig%0A%0A%20%20sig%20%7B%20params%28x%3A%20Integer%29.void%20%7D%0A%20%20def%20f%28x%29%0A%20%20%20%20p%20x%0A%20%20end%0Aend%0A%0AB.prepend%28A%29%0A%0AB.new.f%281%29%0A

Method redefinitions at least checked that behaviour. Not sure how to best to get that back.

I imagine interfaces could be one solution there.

dduugg commented 4 weeks ago

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:

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 commented 3 weeks ago

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!