homebrew-file
homebrew-file copied to clipboard
some `brew-file` operations fail when `mdfind` returns bad information
This is a hard problem to reproduce. Occasionally spotlight seems to have improperly indexed /Applications, and this causes brew-file to break.
The last time it happened, I ran brew file update, and got the following error:
[ERROR] Failed at command: mdls -attr kMDItemAppStoreAdamID -attr kMDItemVersion bad path C66D0C00-0000-0000-9000-006B00000000
bad path C66D0C00-0000-0000-9000-006B00000000: could not find bad path C66D0C00-0000-0000-9000-006B00000000.
I tracked it down to a problem with the output of mdfind 'kMDItemAppStoreHasReceipt=1':
/Applications/Wallaroo.app
/Applications/Kagi for Safari.app
/Applications/PCalc.app
/Applications/AutoMounter.app
/Applications/NewFileMenu.app
/Applications/Okta Verify.app
/Applications/Screens 5.app
/Applications/Discovery.app
/Applications/StopTheMadness Pro.app
bad path C66D0C00-0000-0000-9000-006B00000000
bad path 19F07200-0000-0000-9000-006B00000000
bad path A6420E00-0000-0000-9000-006B00000000
bad path B6286400-0000-0000-9000-006B00000000
bad path 93467800-0000-0000-9000-006B00000000
I fix it by disabling/reenabling spotlight, forcing a re-index, but it eventually comes back.
Of course the real problem is with spotlight and not brew-file, but I'm filing the issue in case brew-file wants to be more robust when processing mdfind output.
Though I could not reproduce the problem, I added to check the app there. If it is wrong name (or if the app does not exist), brew-file just shows warning and continues. Could you please try v9.0.19?
Hi it took a while to verify this, since spotlight needs to be in a particular state. But it's doing it now, and brew-file seems to be working. I see the 'mdfind' warning output when brew-file runs brew upgrade --cask but the operation goes on to succeed I believe:
❱ brew file update
$ brew update
==> Updating Homebrew...
Already up-to-date.
$ brew upgrade --formula
$ brew upgrade --cask
[WARNING] Incorrect app name in mdfind: bad path A6420E00-0000-0000-B000-006B00000000
[WARNING] Incorrect app name in mdfind: bad path AC12AD00-0000-0000-B000-006B00000000
[WARNING] Incorrect app name in mdfind: bad path C66D0C00-0000-0000-B000-006B00000000
[WARNING] Incorrect app name in mdfind: bad path 8A24A000-0000-0000-B000-006B00000000
[WARNING] Incorrect app name in mdfind: bad path 06A4F000-0000-0000-B000-006B00000000
[WARNING] Incorrect app name in mdfind: bad path 09A7F000-0000-0000-B000-006B00000000
[WARNING] Incorrect app name in mdfind: bad path 2D00E700-0000-0000-B000-006B00000000
########################
# Clean up cask packages
########################
########################
# Clean up brew packages
########################
#######################
# Clean up tap packages
#######################
################
# Clean up cache
################
$ brew cleanup