Homebrew / brew

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

`brew lc` on some formulae or casks will throw an error #14465

Closed singularitti closed 1 year ago

singularitti commented 1 year ago

brew gist-logs <formula> link OR brew config AND brew doctor output

$ brew config
HOMEBREW_VERSION: 3.6.20-146-g4b3d64d
ORIGIN: https://github.com/Homebrew/brew
HEAD: 4b3d64d307c8aa7f364c3f854a0b4dc29d59ecd0
Last commit: 31 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: ec5077b259e0732b564513ee3e35ce3d39d28044
Core tap last commit: 4 days ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: code
HOMEBREW_INSTALL_FROM_API: set
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 14.0.0 build 1400
Git: 2.37.1 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.86.0 => /usr/bin/curl
macOS: 13.2-arm64
CLT: 14.2.0.0.1.1668646533
Xcode: N/A
Rosetta 2: false
$ brew doctor
Your system is ready to brew.

Verification

What were you trying to do (and why)?

I was trying to brew livecheck my formulae and casks.

What happened (include all command output)?

I run the following command

$ brew lc dash
Warning: Treating dash as a formula.
Error: dash: Unable to get versions

$ brew livecheck dash
Warning: Treating dash as a formula. For the cask, use homebrew/cask/dash
dash: 0.5.12 ==> 0.5.12

$ brew lc julia
Warning: Treating julia as a formula.
julia: 1.8.5 ==> 1.8.5

$ brew lc alfred
Error: alfred: Unable to get versions

$ brew livecheck alfred
alfred: 5.0.6,2110 ==> 5.0.6,2110

What did you expect to happen?

brew lc return the same results as brew livecheck.

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

brew lc dash
brew livecheck dash
gromgit commented 1 year ago

export HOMEBREW_NO_INSTALL_FROM_API=1 and try brew lc ... again.

@Homebrew/brew, this is a weird side-effect of the API install migration. I can't figure out why the base command works perfectly, but the internal alias seems to take another path. Setting HOMEBREW_NO_INSTALL_FROM_API "restores harmony" somehow.

singularitti commented 1 year ago

It works now:

$ export HOMEBREW_NO_INSTALL_FROM_API=1

$ brew lc alfred
alfred: 5.0.6,2110 ==> 5.0.6,2110

$ brew lc dash
Warning: Treating dash as a formula. For the cask, use homebrew/cask/dash
dash: 0.5.12 ==> 0.5.12
owine commented 1 year ago

I am having some livechecks hang indefinitely and when I Ctrl+C out of it I see errors similar to the following:

Error: macupdater: Directory not empty @ dir_s_rmdir - /private/tmp/d20230130-13581-1f82q6m
dawidd6 commented 1 year ago

Also a strange behavior:

linuxbrew@28113b04b932:~$ brew lc -h
Usage: brew livecheck, lc [options] [formula|cask ...]

Check for newer versions of formulae and/or casks from upstream.

If no formula or cask argument is passed, the list of formulae and casks to
check is taken from HOMEBREW_LIVECHECK_WATCHLIST or
~/.brew_livecheck_watchlist.

      --full-name                  Print formulae and casks with fully-qualified
                                   names.
      --tap                        Check formulae and casks within the given
                                   tap, specified as user/repo.
      --eval-all                   Evaluate all available formulae and casks,
                                   whether installed or not, to check them.
      --installed                  Check formulae and casks that are currently
                                   installed.
      --newer-only                 Show the latest version only if it's newer
                                   than the formula/cask.
      --json                       Output information in JSON format.
  -r, --resources                  Also check resources for formulae.
  -q, --quiet                      Suppress warnings, don't print a progress bar
                                   for JSON output.
      --formula, --formulae        Only check formulae.
      --cask, --casks              Only check casks.
  -d, --debug                      Display any debugging information.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.
linuxbrew@28113b04b932:~$ brew developer
Developer mode is disabled.
linuxbrew@28113b04b932:~$ brew livecheck -h
Warning: livecheck is a developer command, so
Homebrew's developer mode has been automatically turned on.
To turn developer mode off, run brew developer off

Usage: brew livecheck, lc [options] [formula|cask ...]

Check for newer versions of formulae and/or casks from upstream.

If no formula or cask argument is passed, the list of formulae and casks to
check is taken from HOMEBREW_LIVECHECK_WATCHLIST or
~/.brew_livecheck_watchlist.

      --full-name                  Print formulae and casks with fully-qualified
                                   names.
      --tap                        Check formulae and casks within the given
                                   tap, specified as user/repo.
      --eval-all                   Evaluate all available formulae and casks,
                                   whether installed or not, to check them.
      --installed                  Check formulae and casks that are currently
                                   installed.
      --newer-only                 Show the latest version only if it's newer
                                   than the formula/cask.
      --json                       Output information in JSON format.
  -r, --resources                  Also check resources for formulae.
  -q, --quiet                      Suppress warnings, don't print a progress bar
                                   for JSON output.
      --formula, --formulae        Only check formulae.
      --cask, --casks              Only check casks.
  -d, --debug                      Display any debugging information.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.
linuxbrew@28113b04b932:~$ brew developer   
Developer mode is enabled.
dawidd6 commented 1 year ago

Different behavior is probably caused by differences between: https://github.com/Homebrew/brew/blob/7a5f6143d3e7447a64255c548d2e51138c83acd3/Library/Homebrew/brew.sh#L692-L708 and https://github.com/Homebrew/brew/blob/7a5f6143d3e7447a64255c548d2e51138c83acd3/Library/Homebrew/commands.rb#L14-L32

dawidd6 commented 1 year ago

Should be resolved. Let us know if not.

singularitti commented 1 year ago

It works for me now!