Coder Social home page Coder Social logo

Comments (11)

metayan avatar metayan commented on August 15, 2024 1

Great. Thanks for the explanation. And the fix.

from brew.

MikeMcQuaid avatar MikeMcQuaid commented on August 15, 2024

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

@metayan If you follow these instructions yourself: does it both install all these formulae and remove them? If you install them manually: are they removed every time?

from brew.

metayan avatar metayan commented on August 15, 2024

Installed darktable 4.6.1 again, by tweaking the formula.
Then removed darktable.
This time the removal also tried to autoremove other things:

brew install --cask darktable
==> Downloading https://github.com/darktable-org/darktable/releases/download/release-4.6.1/darktable-4.6.1-x86_64.dmg
==> Installing Cask darktable
==> Moving App 'darktable.app' to '/Applications/darktable.app'
🍺  darktable was successfully installed!
brew remove darktable
==> Uninstalling Cask darktable
==> Backing App 'darktable.app' up to '/usr/local/Caskroom/darktable/4.6.1/darktable.app'
==> Removing App '/Applications/darktable.app'
==> Purging files for version 4.6.1 of Cask darktable
==> Autoremoving 1 unneeded formula:
ntfs-3g
Error: ntfs-3g is pinned. You must unpin it to uninstall.
brew info ntfs-3g
==> ntfs-3g: stable 2022.10.3, HEAD [pinned at 2017.3.23_3]
Read-write NTFS driver for FUSE
https://www.tuxera.com/community/open-source-ntfs-3g/
Installed
/usr/local/Cellar/ntfs-3g/2017.3.23_3 (89 files, 1.7MB) *
  Poured from bottle on 2020-06-20 at 01:53:27

Feel free to ask for more info if needed.

from brew.

metayan avatar metayan commented on August 15, 2024

I just feel that removing a cask – that has no Homebrew dependencies – shouldn't remove any installed apps that have nothing to do with the cask in question.

from brew.

MikeMcQuaid avatar MikeMcQuaid commented on August 15, 2024

What does brew autoremove --dry-run output?

from brew.

metayan avatar metayan commented on August 15, 2024
brew autoremove --dry-run
==> Would autoremove 1 unneeded formula:
ntfs-3g

But it already removed all the autoremovable formulas before, when doing

brew remove darktable

as I reported above.
And ntfs-3g is pinned.

from brew.

MikeMcQuaid avatar MikeMcQuaid commented on August 15, 2024

@metayan Can you paste the output of cat $(brew --prefix ntfs-3g)/INSTALL_RECEIPT.json? Thanks.

from brew.

metayan avatar metayan commented on August 15, 2024
cat $(brew --prefix ntfs-3g)/INSTALL_RECEIPT.json |jq '.'
{
  "homebrew_version": "2.4.0-53-g748af98",
  "used_options": [],
  "unused_options": [],
  "built_as_bottle": true,
  "poured_from_bottle": true,
  "installed_as_dependency": null,
  "installed_on_request": null,
  "changed_files": [
    "sbin/mount_ntfs",
    "INSTALL_RECEIPT.json",
    "lib/pkgconfig/libntfs-3g.pc"
  ],
  "time": 1592610807,
  "source_modified_time": 1490262180,
  "HEAD": null,
  "stdlib": null,
  "compiler": "clang",
  "aliases": [],
  "runtime_dependencies": [
    {
      "full_name": "gettext",
      "version": "0.20.2"
    }
  ],
  "source": {
    "path": "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/ntfs-3g.rb",
    "tap": "homebrew/core",
    "spec": "stable",
    "versions": {
      "stable": "2017.3.23",
      "devel": "",
      "head": "HEAD",
      "version_scheme": 0
    }
  }
}

from brew.

Rylan12 avatar Rylan12 commented on August 15, 2024
  "installed_as_dependency": null,
  "installed_on_request": null,

These lines are causing autoremove to try and remove the formula. You can stop this from happening by running:

brew tab --installed-on-request ntfs-3g

I'm not totally sure why the values where written as null, but perhaps it has something to do with brew pin handling? Either way, we should handle this case by erring on the side of caution and not removing the formula. I've opened a PR to implement this.

from brew.

metayan avatar metayan commented on August 15, 2024

The pinned formula was not removed, so no worries about that.

The issue is that 89 formulas were autoremoved when a cask was removed. Formulas that had nothing to do with the cask.
As can be seen above after

==> Autoremoving 89 unneeded formulae:

At least a request for confirmation that 89 formulas will be removed would be appropriate.

from brew.

Rylan12 avatar Rylan12 commented on August 15, 2024

The PR merged should indeed fix this problem.

In this case, the problem seems to be that somehow the install metadata on your system was messed up, and did not properly mark that those formulae were installed at your request (as opposed to as a dependency for something else). I'm not sure at the moment why that happened, but the PR I merged strengthens the check so that Homebrew treats messed up metadata as "not sure, but let's assume they are installed on request and keep them around just in case." In the future, autoremove will only remove formulae that have "installed_on_request": false (as opposed to null) to avoid this from happening again.

from brew.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.