Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finch: fix uninstall script #140436

Closed
wants to merge 1 commit into from
Closed

Conversation

AnqiPang
Copy link
Contributor

Important: Do not tick a checkbox if you haven’t performed its action. Honesty is indispensable for a smooth review process.

In the following questions <cask> is the token of the cask you're submitting.

After making all changes to a cask, verify:

Additionally, if adding a new cask:

  • Named the cask according to the token reference.
  • Checked the cask was not already refused.
  • Checked the cask is submitted to the correct repo.
  • brew audit --new-cask <cask> worked successfully.
  • brew install --cask <cask> worked successfully.
  • brew uninstall --cask <cask> worked successfully.

@miccal
Copy link
Contributor

miccal commented Jan 31, 2023

@AnqiPang what is the reason for this change?

@miccal miccal added the awaiting user reply Issue needs response from a user. label Jan 31, 2023
@AnqiPang
Copy link
Contributor Author

AnqiPang commented Jan 31, 2023

@AnqiPang what is the reason for this change?

Hi, I noticed that the uninstall script with sudo option couldn't delete the finch's installation directory /Applications/Finch since maybe a few days ago. I can confirm it previously worked fine. Now the log is as below.

brew uninstall --cask -f finch
==> Uninstalling Cask finch
==> Running uninstall script /Applications/Finch/uninstall.sh
Please run as root.
==> Purging files for version 0.3.0 of Cask finch
which finch                         
/usr/local/bin/finch

Because the Finch uninstall script requires root permission. The script/Applications/Finch/uninstall.sh exits early if it verifies $EUID!=0. I tried removing the EUID check from the uninstall.sh and then run brew uninstall --cask finch again, but got some permission denied errors when deleting some files as below.

brew uninstall --cask finch
==> Uninstalling Cask finch
==> Running uninstall script /Applications/Finch/uninstall.sh
Welcome to Finch Uninstaller
The following packages will be REMOVED:
 Finch-v0.3.0
Application uninstalling process started
[1/3] [DONE] Successfully deleted shortcut links
[2/3] [DONE] Successfully deleted application informations
rm: /Applications/Finch/dependencies/lima-socket_vmnet/opt/finch/bin/socket_vmnet_client: Permission denied
rm: /Applications/Finch/dependencies/lima-socket_vmnet/opt/finch/bin/socket_vmnet: Permission denied
rm: /Applications/Finch/dependencies/lima-socket_vmnet/opt/finch/bin: Permission denied
rm: /Applications/Finch/dependencies/lima-socket_vmnet/opt/finch: Permission denied
rm: /Applications/Finch/dependencies/lima-socket_vmnet/opt: Permission denied
rm: /Applications/Finch/dependencies/lima-socket_vmnet: Permission denied
rm: /Applications/Finch/dependencies: Permission denied
rm: /Applications/Finch: Permission denied
[3/3] [ERROR] Could not delete application
Application uninstall process finished
==> Purging files for version 0.3.0 of Cask finch

We have the $EUID check since v0.1.0 and it worked fine previously. I'm wondering whether something changes happened on Homebrew's end since it seems brew is not executing the uninstall script with sudo. I opened a discussion here. If it's a bug in the uninstall.sh script, I think we can use the delete command to uninstall the pkg instead. Please correct if I'm wrong. Thank you!

@miccal miccal added awaiting maintainer feedback Issue needs response from a maintainer. and removed awaiting user reply Issue needs response from a user. labels Jan 31, 2023
Copy link
Member

@carlocab carlocab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a bug in brew and should be fixed there instead.

@AnqiPang, what is the output of brew config and brew doctor on the machine where you had issues with uninstalling?

@AnqiPang
Copy link
Contributor Author

AnqiPang commented Feb 1, 2023

what is the output of brew config and brew doctor on the machine where you had issues with uninstalling?

 brew config
HOMEBREW_VERSION: 3.6.20-153-g79676ad
ORIGIN: https://github.com/Homebrew/brew
HEAD: 79676ad20d56a7e913ad9185fb5c7236bb2378e0
Last commit: 29 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 369d38a2dd04607af4199bd3cc87ef5db86fb881
Core tap last commit: 34 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_INSTALL_FROM_API: set
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: dodeca-core 64-bit kabylake
Clang: 14.0.0 build 1400
Git: 2.38.0 => /usr/local/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.6.1-x86_64
CLT: 14.2.0.0.1.1668646533
Xcode: N/A
brew doctor                                        
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: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  docker-credential-helper-ecr
  awscli
  vde
  kubernetes-cli

@carlocab
Copy link
Member

carlocab commented Feb 1, 2023

CC @Rylan12

@carlocab
Copy link
Member

carlocab commented Feb 1, 2023

Thanks. Can you try to do

export HOMEBREW_NO_INSTALL_FROM_API=1

and then see if uninstalling without this change works?

@AnqiPang
Copy link
Contributor Author

AnqiPang commented Feb 1, 2023

It works! Thank you. Does that mean we have to set export HOMEBREW_NO_INSTALL_FROM_API=1 on every host in order to uninstall the cask that requires sudo?

export HOMEBREW_NO_INSTALL_FROM_API=1
brew uninstall --cask finch          
==> Uninstalling Cask finch
==> Running uninstall script /Applications/Finch/uninstall.sh
Welcome to Finch Uninstaller
The following packages will be REMOVED:
  Finch-v0.3.0
Application uninstalling process started
[1/3] [DONE] Successfully deleted shortcut links
[2/3] [DONE] Successfully deleted application informations
[3/3] [DONE] Successfully deleted application
Application uninstall process finished
==> Purging files for version 0.3.0 of Cask finch

@carlocab
Copy link
Member

carlocab commented Feb 1, 2023

Does that mean we have to set export HOMEBREW_NO_INSTALL_FROM_API=1 on every host in order to uninstall the cask that requires sudo?

For now, yes. But this is a bug that definitely needs fixing, so you shouldn't have to have this set permanently.

@cho-m cho-m added the core Issue with Homebrew itself rather than with a specific cask. label Feb 1, 2023
@AnqiPang
Copy link
Contributor Author

AnqiPang commented Feb 1, 2023

Should we close this PR since brew is going to fix it?

@miccal miccal closed this Feb 2, 2023
@miccal miccal removed awaiting maintainer feedback Issue needs response from a maintainer. core Issue with Homebrew itself rather than with a specific cask. labels Feb 2, 2023
@Rylan12
Copy link
Member

Rylan12 commented Feb 5, 2023

@AnqiPang this bug should now be fixed. You should no longer need to set HOMEBREW_NO_INSTALL_FROM_API to uninstall finch.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants