eduncan911/dotfiles

brew-cask works ahead without any warnings when network is way

Closed this issue · 6 comments

Hi there,

I've really benefited a lot from brew-cask.sh upgrade command, which saved me a lot of time by a simple command rather than clicking the upgrade command within each app.
But there is one issue faced recently, when the network is down, I found the script still works ahead without even promoting any warning, I wonder if you can take a look at the code and fix this?

Thanks!

I use this and love it. but it has recently started playing up.

I get the following - I have searched on the "Invalid Tap name "/' wic seems to be the primary error, but find nothing.

./brew-cask.sh update
Inspecting 122 casks. Use 'brew-cask.sh upgrade' to perform any updates.
Error: Invalid tap name '/'
Follow the instructions here:
https://github.com/caskroom/homebrew-cask/blob/master/doc/reporting_bugs/pre_bug_report.md

If this doesn’t fix the problem, please report this bug:
https://github.com/caskroom/homebrew-cask#reporting-bugs

/usr/local/Homebrew/Library/Homebrew/tap.rb:29:in fetch' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/info.rb:55:in repo_info'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/info.rb:23:in info' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/info.rb:11:in block in run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/info.rb:7:in each' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/info.rb:7:in run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:115:in run_command' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:158:in process'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in cask' /usr/local/Homebrew/Library/Homebrew/brew.rb:91:in

'
actprinter eagle

Is the issue that when there is no network connection, this kind of error occurs?

I'll admit, I've never tested it offline since my inet is very stable.

Nope. Tried a dozen times or more, Internet active throughout.

I'm not able to repo. I've slimmed down my workstations to only 1 or 2 casks now as I no longer use caskroom for the majority of my apps, since they all have automatic upgrades - and I just don't install that much any more.

Can you do the following:

  1. What osx version are you on? I'm on 10.12.4.

  2. brew --version and brew cask --version (they should match) Mine are 1.1.12.

  3. Run doctor on both to see if everything is ok: brew docotor and brew cask doctor

  4. Finally, post a list of all your Casks. 122 is quite excessive!!! I had upwards of 15 or 20 at one time and I thought that was insane. You, sir, take the prize for the most I've ever heard! 👍

brew cask list

Perhaps one of these packages has an older name, or a slash in it, or something. The fact that the error has Invalid tap name '/' tells me it's going to be a custom install that needed to be tapped.


There was a transition last year (or maybe 1.5 years ago) for Caskroom that required the home to be moved. I know it fracked with several of my casks and basically corrupted things beyond what I was willing to mess with. Lots of odd issues trying to force install, too many wasted versions not uninstalled, etc.

That's when I just paved my machine (I do this a lot, btw) and just reinstalled fresh.


I don't have much I install. Pretty standard whenever I pave my machine:

Chrome
Chromium (caskroom version failed to upgrade sometimes)
Docker
Eye-Friendly (app store)
Tunnelblick (Caskroom version always had issues on upgrading)
GeekTool (had some issues upgrading it)
Karabiner (so many issues with caskroom version with custom configs to share)
TripMode

The only cask I have installed now is Java as I DO NOT want that crap to upgrade without my saying so. No background stuff, no browser stuff, nada.

This script doesn't do anything special for the install. It basically just looks around at what you have installed, compares it to what is available, and lists out the names in a pretty format. brew-cask.sh update just does:

brew cask info <cask-name>

and it takes its output, looks for the Version number, and compares it to the currently installed version number.

Humm... Maybe someone used a Version number with a "/" slash in it? I wonder which one though, out of a list of 122...

As far as brew-cask.sh upgrade, all it does is:

brew cask info <cask-name>

Which is piped to a sed command to filter its output - and the output hasn't changed.

Then it does:

brew cask install <cask-name> --force

I mean, the entire script is this:

#!/bin/bash
casks=( $(brew cask list) )

if [[ "$1" == "upgrade" ]]; then
  for cask in ${casks[@]}; do
    current="$(brew cask info $cask | sed -n '1p' | sed -n 's/^.*: \(.*\)$/\1/p')"
    installed=( $(ls /usr/local/Caskroom/$cask))
    if (! [[ " ${installed[@]} " == *" $current "* ]]); then
      echo "Upgrading $cask to v$current."
      (set -x; brew cask install $cask --force;)
    else
      echo "$cask v$current is up-to-date, skipping."
    fi
  done
else
  echo "Inspecting ${#casks[@]} casks. Use 'brew-cask.sh upgrade' to perform any updates."
  for (( i = i ; i < ${#casks[@]} ; i++ )); do
    current="$(brew cask info ${casks[$i]} | sed -n '1p' | sed -n 's/^.*: \(.*\)$/\1/p')"
    installed=( $(ls /usr/local/Caskroom/${casks[$i]}))
    if (! [[ " ${installed[@]} " == *" $current "* ]]); then
      casks[$i]="${casks[$i]}$(tput sgr0)$(tput setaf 2) ✔$(tput sgr0)"
    fi
  done
  echo " ${casks[@]/%/$'\n'}" | column
fi

Not really a whole lot going on there.


Have you tried running some of the newer brew cask commands that have come out since I wrote this script?

brew cask cleanup # should remove all older versions
brew cask reinstall <cask-name> --force # fixes a lot of symlinks and does some cleanup
brew cask outdated # this looks interesting

--

Going to close this for now. I think the latest version of Homebrew has casks built in now?

I've since switched to almost exclusively to Linux on all home machines - and no longer use macOS for development - except for some work stuff.

If further investigation is wanted, feel free to reopen and let's try to track down the issue.