Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.58k stars 12.33k forks source link

sl: `brew uninstall sl` produces misleading warning about openssl #177425

Open woodruffw opened 2 months ago

woodruffw commented 2 months ago

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

$ brew config
HOMEBREW_VERSION: 4.3.9-265-g75e77db
ORIGIN: https://github.com/Homebrew/brew
HEAD: 75e77db9f4c5b0760d464722a3298f44785c8dc2
Last commit: 57 minutes ago
Core tap HEAD: 4f7989feaa16e0f1987a1abc6614967f0f9e32d8
Core tap last commit: 25 hours ago
Core tap JSON: 15 Jul 20:59 UTC
Core cask tap JSON: 15 Jul 20:59 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 10
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.3.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.44.0 => /opt/homebrew/bin/git
Curl: 8.6.0 => /usr/bin/curl
macOS: 14.5-arm64
CLT: 15.3.0.0.1.1708646388
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 show sl (a very important program) to @Moisan and then uninstall it afterwards.

What happened (include all command output)?

$ brew uninstall sl
Uninstalling /opt/homebrew/Cellar/sl/5.02... (7 files, 40.0KB)

Warning: The following may be sl configuration files and have not been removed!
If desired, remove them manually with `rm -rf`:
  /opt/homebrew/etc/openssl@1.1
  /opt/homebrew/etc/openssl@3

What did you expect to happen?

The above, but with no misleading warning about deleting openssl's configurations.

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

brew install sl
brew uninstall sl
Bo98 commented 2 months ago

The word "may" is because the check for this is rudimentary: https://github.com/Homebrew/brew/blob/75e77db9f4c5b0760d464722a3298f44785c8dc2/Library/Homebrew/uninstall.rb#L69-L72. Not all formulae use the pkgetc system.

cho-m commented 1 month ago

It does seem a bit risky to recommend rm -rf-ing directories which some users may blindly run and break functionality.

We could track etc files that are included inside bottle with some extra record keeping. Though there isn't a great way to track all etc files as some are created at runtime (may need something more manual like Casks).