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

Transitive dependencies not uninstalled in correct order #14

Closed
irundaia opened this issue Jan 6, 2017 · 13 comments
Closed

Transitive dependencies not uninstalled in correct order #14

irundaia opened this issue Jan 6, 2017 · 13 comments

Comments

@irundaia
Copy link

irundaia commented Jan 6, 2017

I've had gnupg2 installed for quite some time and I wanted to remove it. So I called brew rmtree gnupg2.

This listed the following dependencies:

Can safely be removed
----------------------
dirmngr
gpg-agent
libassuan
libgcrypt
libgpg-error
libksba
libusb
libusb-compat
pinentry
pth

After accepting the uninstallation of all these packages, brew failed to uninstall several dependencies because they were needed for some dependencies in this list. For instance, it started with uninstalling libgpg-error, which was still required for dirmngr. Below I've attached the log of the first run of brew rmtree (I've used it to also uninstall the refused formulae after the first run).

Uninstalling /usr/local/Cellar/gnupg2/2.0.30_2... (91 files, 3.7M)

Error: Refusing to uninstall /usr/local/Cellar/libgpg-error/1.26
because it is required by dirmngr, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies libgpg-error


Error: Refusing to uninstall /usr/local/Cellar/libgcrypt/1.7.5
because it is required by dirmngr, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies libgcrypt


Error: Refusing to uninstall /usr/local/Cellar/libksba/1.3.5
because it is required by dirmngr, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies libksba


Error: Refusing to uninstall /usr/local/Cellar/libassuan/2.4.3_1
because it is required by dirmngr, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies libassuan


Error: Refusing to uninstall /usr/local/Cellar/pinentry/0.9.7
because it is required by gpg-agent, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies pinentry


Error: Refusing to uninstall /usr/local/Cellar/pth/2.0.7
because it is required by dirmngr, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies pth


Uninstalling /usr/local/Cellar/gpg-agent/2.0.30_1... (11 files, 695.6K)

Uninstalling /usr/local/Cellar/dirmngr/1.1.1_2... (66 files, 527.6K)

Error: Refusing to uninstall /usr/local/Cellar/libusb/1.0.20
because it is required by libusb-compat, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies libusb


Uninstalling /usr/local/Cellar/libusb-compat/0.1.5... (13 files, 93.3K)
@Argon-
Copy link

Argon- commented Jan 6, 2017

Unfortunately this repo seems to be dead/inactive. I guess it's best to settle for one of the forks to continue, e.g. https://github.com/jsfaint/homebrew-rmtree as it solves the (as of now probably most important) problem explained in #11

@irundaia
Copy link
Author

irundaia commented Jan 6, 2017

This issue is also a problem in the linked repo. I'd create an issue there as well, if the repo allowed the creation of issues

@ilovezfs
Copy link

ilovezfs commented Jan 6, 2017

If you export HOMEBREW_DEVELOPER=1 the errors will be warnings so it at least won't go 💥

@beeftornado
Copy link
Owner

Thanks for reporting this, and thanks for the detailed example. I'll look into this

@jsfaint
Copy link
Contributor

jsfaint commented Jan 13, 2017

Hi @Argon- My PR was already merged by @beeftornado
Thanks @beeftornado 😄

@metakirby5
Copy link

I got around this by adding the --ignore-dependencies flag to this line. I'm not sure if this is a "clean" solution, but it seems to have worked for me.

@irundaia
Copy link
Author

@metakirby5 Doesn't this mean that the dependencies aren't removed?

@ilovezfs
Copy link

No.

If HOMEBREW_DEVELOPER is not set, and there are reverse dependencies using a formula, brew will error out if you try to remove that formula. --ignore-dependencies will suppress the error.

If HOMEBREW_DEVELOPER is set, and there are reverse dependencies using a formula, brew will issue a warning if you try to remove that formula. --ignore-dependencies will suppress the warning.

The fact that rmtree needs to use --ignore-dependencies means that it is in fact removing things that have reverse dependencies.

@irundaia
Copy link
Author

I'm not sure if this will be the behaviour I'm looking for though, as this might uninstall packages that might be needed for other packages.

@ilovezfs
Copy link

ilovezfs commented Jan 25, 2017

@irundaia theoretically it should be fine because the cause is that the packages are being removed in the "wrong" order instead of all at once or in the "right" order. The "correct" fix here is to remove them in a single call to brew uninstall, "brew uninstall A B C D" or to do the uninstalls in an order that always removes a reverse dependency before its dependencies.

@ggPeti
Copy link

ggPeti commented Feb 23, 2017

In the meantime I put together a quick hack to recursively remove dependencies. Check it out: https://github.com/ggPeti/homebrew-rmrec

@irundaia
Copy link
Author

@ggPeti, I've tested your work, it seems to work fine :) It does seem to be a tad slow tbh. But I can deal with that. :)

@interpretor interpretor mentioned this issue Jul 14, 2017
@beeftornado
Copy link
Owner

Related to #21 #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants