Homebrew / brew

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

brew update or upgade: warnings due to camel case #10883

Closed didier-durand closed 3 years ago

didier-durand commented 3 years ago

brew config output

brew config HOMEBREW_VERSION: 3.0.7-33-g05f1c37 ORIGIN: https://github.com/Homebrew/brew HEAD: 05f1c37ae0a551ca3936ca404a1fe2ee33bfd137 Last commit: 2 hours ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: 6cb639986ae79d07804c33bbb81c7974179b20bf Core tap last commit: 3 minutes ago Core tap branch: master HOMEBREW_PREFIX: /usr/local HOMEBREW_CASK_OPTS: [] HOMEBREW_MAKE_JOBS: 8 Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby CPU: octa-core 64-bit skylake Clang: 12.0 build 1200 Git: 2.31.0 => /usr/local/bin/git Curl: 7.64.1 => /usr/bin/curl macOS: 11.2.3-x86_64 CLT: 12.4.0.0.1.1610135815 Xcode: 12.4

brew doctor output

Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed kegs have no formulae! This means they were either deleted or installed with brew diy. You should find replacements for the following formulae: python@2 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1267: warning: already initialized constant FileUtils::Entry_::S_IF_DOOR /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1267: warning: previous definition of S_IFDOOR was here /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1540: warning: already initialized constant FileUtils::Entry::DIRECTORY_TERM /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1540: warning: previous definition of DIRECTORYTERM was here /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1542: warning: already initialized constant FileUtils::Entry::SYSCASE /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1542: warning: previous definition of SYSCASE was here /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1595: warning: already initialized constant FileUtils::OPT_TABLE /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1595: warning: previous definition of OPT_TABLE was here /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1649: warning: already initialized constant FileUtils::LOW_METHODS /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1649: warning: previous definition of LOW_METHODS was here /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1656: warning: already initialized constant FileUtils::METHODS /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1656: warning: previous definition of METHODS was here

What were you trying to do (and why)?

I run brew upgrade and update to be up to date on my MacOs laptop

What happened (include all command output)?

The following pair of warnings are emitted by the brew command for both update and upgrade. They are due to the fact that the spelling fileutils vs FileUtils

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1267: warning: already initialized constant FileUtils::Entry_::S_IF_DOOR /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1267: warning: previous definition of S_IFDOOR was here /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1540: warning: already initialized constant FileUtils::Entry::DIRECTORY_TERM /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1540: warning: previous definition of DIRECTORYTERM was here /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1542: warning: already initialized constant FileUtils::Entry::SYSCASE /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1542: warning: previous definition of SYSCASE was here /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1595: warning: already initialized constant FileUtils::OPT_TABLE /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1595: warning: previous definition of OPT_TABLE was here /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1649: warning: already initialized constant FileUtils::LOW_METHODS /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1649: warning: previous definition of LOW_METHODS was here /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1656: warning: already initialized constant FileUtils::METHODS /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1656: warning: previous definition of METHODS was here

What did you expect to happen?

I would expect no such warnings

Step-by-step reproduction instructions (by running brew commands)

Either 'brew upgrade' or 'brew update' will trigger them.

carlocab commented 3 years ago

Try to do brew update-reset, but make a note of the following:

❯ brew help update-reset
Usage: brew update-reset [repository ...]

Fetch and reset Homebrew and all tap repositories (or any specified
repository) using git(1) to their latest origin/HEAD.

Note: this will destroy all your uncommitted or committed changes.

If that doesn't work, please share the output of brew readall.

Bo98 commented 3 years ago

It looks like there's a require "FileUtils" somewhere (it should be all lowercase), but there's not anything in brew itself which is doing that. I suspect it's some tap.

In addition to the above, what's the output of brew tap?

didier-durand commented 3 years ago

@Bo98 : Hi Bo, here is brew tap. Didier

% brew tap
aquasecurity/trivy
bazelbuild/tap
ethereum/ethereum
hivemq/mqtt-cli
homebrew/cask
homebrew/cask-versions
homebrew/core
knative/client
tektoncd/tools
ubuntu/microk8s
didier-durand commented 3 years ago

@carlocab : Hi Carlo, brew update-reset didn't remove the warning. Here is brew readall. Didier

brew readall
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1267: warning: already initialized constant FileUtils::Entry_::S_IF_DOOR
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1267: warning: previous definition of S_IF_DOOR was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1540: warning: already initialized constant FileUtils::Entry_::DIRECTORY_TERM
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1540: warning: previous definition of DIRECTORY_TERM was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1542: warning: already initialized constant FileUtils::Entry_::SYSCASE
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1542: warning: previous definition of SYSCASE was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1595: warning: already initialized constant FileUtils::OPT_TABLE
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1595: warning: previous definition of OPT_TABLE was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1649: warning: already initialized constant FileUtils::LOW_METHODS
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1649: warning: previous definition of LOW_METHODS was here
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/FileUtils.rb:1656: warning: already initialized constant FileUtils::METHODS
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1656: warning: previous definition of METHODS was here
Warning: Aleth (formerly cpp-ethereum) has been removed from Homebrew. Please install binary releases from https://github.com/ethereum/aleth/releases.
gromgit commented 3 years ago

How about grep -ir FileUtils $(brew --repo)/Library/Taps?

didier-durand commented 3 years ago

@gromgit : Hi Adrian, here you go with grep.

% grep -ir FileUtils $(brew --repo)/Library/Taps
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.19.rb:  require "FileUtils"
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.19.rb:  require "fileutils"
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.19.rb:      FileUtils.mv("kn-darwin-amd64", "kn")
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.19.rb:      FileUtils.mv("kn-linux-amd64", "kn")
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.18.rb:  require "FileUtils"
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.18.rb:  require "fileutils"
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.18.rb:      FileUtils.mv("kn-darwin-amd64", "kn")
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.18.rb:      FileUtils.mv("kn-linux-amd64", "kn")
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.17.rb:  require "FileUtils"
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.17.rb:  require "fileutils"
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.17.rb:      FileUtils.mv("kn-darwin-amd64", "kn")
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.17.rb:      FileUtils.mv("kn-linux-amd64", "kn")
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn.rb:  require "FileUtils"
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn.rb:  require "fileutils"
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn.rb:      FileUtils.mv("kn-darwin-amd64", "kn")
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn.rb:      FileUtils.mv("kn-linux-amd64", "kn")
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.20.rb:  require "FileUtils"
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.20.rb:  require "fileutils"
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.20.rb:      FileUtils.mv("kn-darwin-amd64", "kn")
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.20.rb:      FileUtils.mv("kn-linux-amd64", "kn")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-versions/Casks/blender-lts.rb:    FileUtils.chmod "u+w", Dir.glob("#{staged_path}/*.app/**/__pycache__")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/cmd/postgresql-upgrade-database.rb:      FileUtils.mv datadir, old_datadir
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/cmd/postgresql-upgrade-database.rb:          FileUtils.rm_r datadir
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/cmd/postgresql-upgrade-database.rb:          FileUtils.mv old_datadir, datadir
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/desktop-file-utils.rb:class DesktopFileUtils < Formula
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/dwarf-fortress.rb:      FileUtils.cp_r("#{staged_path}/df_osx/data/save", "/tmp/dwarf-fortress-save/")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/transmit-disk.rb:    FileUtils.mv "/tmp/Transmit/Transmit Disk.app", appdir
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/klayout.rb:    FileUtils.mv(staged_path.children, staged_path.join("KLayout").tap(&:mkpath))
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/origin.rb:    FileUtils.mv(staged_path.children, staged_path.join("Origin.app").tap(&:mkpath))
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/android-sdk.rb:    FileUtils.ln_sf(staged_path.to_s, "#{HOMEBREW_PREFIX}/share/android-sdk")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/android-sdk.rb:    FileUtils.rm_f("#{HOMEBREW_PREFIX}/share/android-sdk")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/crystax-ndk.rb:    FileUtils.ln_sf("#{staged_path}/crystax-ndk-#{version}", "#{HOMEBREW_PREFIX}/share/crystax-ndk")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/crystax-ndk.rb:    FileUtils.rm_f("#{HOMEBREW_PREFIX}/share/crystax-ndk")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/adobe-air-sdk.rb:    FileUtils.ln_sf(staged_path.to_s, "#{HOMEBREW_PREFIX}/share/adobe-air-sdk")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/adobe-air-sdk.rb:    FileUtils.rm_f("#{HOMEBREW_PREFIX}/share/adobe-air-sdk")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/virtual-ii.rb:    FileUtils.mv(staged_path.children, staged_path.join("Virtual ][").tap(&:mkpath))
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/blender.rb:    FileUtils.chmod "u+w", Dir.glob("#{staged_path}/*.app/**/__pycache__")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/minecraft-server.rb:    FileUtils.mkdir_p config_dir
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/minecraft-server.rb:    FileUtils.rm_f eula_file
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/chatty.rb:    FileUtils.mv(staged_path.children, staged_path.join("Chatty").tap(&:mkpath))
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/quakespasm.rb:    FileUtils.mv(staged_path.children, staged_path.join("QuakeSpasm").tap(&:mkpath))
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/android-ndk.rb:    FileUtils.ln_sf("#{staged_path}/android-ndk-r#{version}", "#{HOMEBREW_PREFIX}/share/android-ndk")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/android-ndk.rb:    FileUtils.rm_f("#{HOMEBREW_PREFIX}/share/android-ndk")
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/.github/actions/sync/templates.rb:require 'fileutils'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/.github/actions/sync/templates.rb:    FileUtils.rm_f path
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/.github/actions/sync/templates.rb:    FileUtils.cp path, repo_dir.join(path)
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/.github/actions/sync/templates.rb:FileUtils.rm repo_dir.join('.github/ISSUE_TEMPLATE/02_feature_request.yml')
Binary file /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/.git/objects/pack/pack-15deb27dd1a02cb2a12f92cc36ccd4df67280acb.pack matches
gromgit commented 3 years ago
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.19.rb:  require "FileUtils"
/usr/local/Homebrew/Library/Taps/knative/homebrew-client/kn@0.19.rb:  require "fileutils"

I'm not a Ruby guru, but:

if OS.mac?
  require "FileUtils"
else
  require "fileutils"
end

looks pretty strange to me. You should probably raise an issue with the tap owner (https://github.com/knative/homebrew-client).

didier-durand commented 3 years ago

@gromgit : Adrian, thanks a lot for your analysis. I'll open this issue on the knative homebbrew-client side. Didier

didier-durand commented 3 years ago

For those interested, the follow-up ticket on knative side is https://github.com/knative/homebrew-client/issues/19