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

sandbox delete-source does not uninstall the source dependency #1447

Closed
gregwebs opened this issue Aug 29, 2013 · 13 comments
Closed

sandbox delete-source does not uninstall the source dependency #1447

gregwebs opened this issue Aug 29, 2013 · 13 comments

Comments

@gregwebs
Copy link

I am using the release candidate:
cabal install http://johantibell.com/files/Cabal-1.18.0.tar.gz http://johantibell.com/files/cabal-install-1.18.0.tar.gz

I had a few minor issues with delete-source:

  • cabal sandbox --help does not mention delete-source

Although cabal sandbox list-sources does mention it, which is great.

  • After I ran delete-source it kept using the existing sourced version of the package.

I was expecting it to also delete the existing sourced version. I could see how the current behaviour could be thought of as desirable. However, it is essentially creating build properties that are invisible to the user so I don't think it is a good default unless perhaps list-sources mentions theses pre-existing sourced versions. It was also unclear to me how I would remove that package, so I just wiped out my sandbox and re-installed everything. Perhaps I was supposed to use hc-pkg, but that option is not explained and it doesn ot respond to --help

@tibbe
Copy link
Member

tibbe commented Aug 29, 2013

I think we should fix this before the release if we can. delete-source should also uninstall the package.

@ghost ghost assigned 23Skidoo Aug 29, 2013
@23Skidoo
Copy link
Member

cabal sandbox --help does not mention delete-source
After I ran delete-source it kept using the existing sourced version of the package.

This is by design. Since we don't have an uninstall command, we can't make delete-source automatically uninstall the installed library. This behaviour is no worse than what cabal-dev does. So delete-source is considered "not yet fit for general consumption" and is not shown in --help output by default (although it can be discovered by running list-sources).

Perhaps I was supposed to use hc-pkg, but that option is not explained and it doesn ot respond to --help.

Yes, since we don't have cabal uninstall, hc-pkg is the only way to unregister libraries right now. Making cabal sandbox hc-pkg --help work is a separate issue (#1257).

We can make delete-source print a warning telling the user to run sandbox hc-pkg unregister. I'd still prefer not to show it in --help output by default, but I'm open to persuasion.

@tibbe
Copy link
Member

tibbe commented Aug 29, 2013

Since this looks a bit more involved, lets not block 1.18 on this issue.

How hard is it to actually remove the package? Couldn't delete-source call the (equivalent of) hc-pkg unregister? Would we also have to make sure we delete the actual library?

@gregwebs
Copy link
Author

yeah, I was going to ask why can't delete-source run hc-pkg unregister for now.

The problem is that if delete-source is not fit for consumption than neither is add-source (for the common workflow of temporarily working on something locally before it gets uploaded to hackage).

I love sandboxes because worst case scenario I just wipe them out, re-install, and I haven't effected anything else on my computer. That is another possible suggestion to the user.

@23Skidoo
Copy link
Member

How hard is it to actually remove the package? Couldn't delete-source call the (equivalent of) hc-pkg unregister? Would we also have to make sure we delete the actual library?

Ideally, cabal uninstall would unregister a package, remove all its installed files and uninstall all its reverse dependencies like apt-get does (so that we don't end up with a broken package DB). See also #227 and #648.

The problem is that if delete-source is not fit for consumption than neither is add-source (for the common workflow of temporarily working on something locally before it gets uploaded to hackage).

Why? cabal-dev has the same problem and is used all the time for this scenario.

@gregwebs
Copy link
Author

I don't feel that saying an issue exists in cabal-dev should be satisfactory for cabal. I personally have not had an installation issue in the last year that I couldn't figure out almost immediately, but that is because I am an advanced user that knows to start with cabal-dev or hsenv and use cabal-meta. cabal is what beginners to Haskell will continue to use.

Can you answer our question about running hc-pkg automatically?

I feel that for a sandbox it is ok to do a crappy job uninstalling packages as long as everything is in the sandbox. The user can just wipe the entire sandbox & reinstall it every once in a while.

@23Skidoo
Copy link
Member

I don't feel that saying an issue exists in cabal-dev should be satisfactory for cabal.

Sure, there is room for improvement. Unfortunately, we can't include all the desired features in the first release (the development period for 1.18 has already been longer than we wanted). It's better to get the release out to the users sooner, even with some deficiencies. Sandboxes are quite useful in the present form.

Can you answer our question about running hc-pkg automatically?
I feel that for a sandbox it is ok to do a crappy job uninstalling packages as long as everything is in the sandbox. The user can just wipe the entire sandbox & reinstall it every once in a while.

I'd prefer to just point the user in the direction of hc-pkg unregister until we have cabal uninstall. I'm afraid that silently breaking the sandbox will be more confusing.

@tibbe
Copy link
Member

tibbe commented Aug 30, 2013

Lets document the deficiency in the user guide and fix it in the next release. 1.18 is long overdue already.

@23Skidoo
Copy link
Member

@tibbe I made delete-source print a warning.

@gregwebs
Copy link
Author

I like the new note, that should be enough to avoid user confusion. This release in going to be huge for the community. thanks!

@bgamari
Copy link
Contributor

bgamari commented Oct 10, 2014

I think the decision to omit delete-source should be reconsidered. Intentionally excluding a valid command from documentation will do nothing but confuse users. Yes, the behavior of the command may not be what many expect but we at least need to inform users of what can be done.

The warning printed by delete-source should be sufficient to ensure users understand what cabal has done and what it has not. The ball is then in the user's court.

@ttuegel ttuegel added this to the Cabal-1.24 milestone Apr 23, 2015
@23Skidoo 23Skidoo modified the milestones: Cabal 1.24, Cabal 1.26 Feb 21, 2016
@ezyang ezyang modified the milestone: Cabal 2.0 Sep 6, 2016
@23Skidoo 23Skidoo removed their assignment Sep 13, 2016
@gbaz
Copy link
Collaborator

gbaz commented Feb 7, 2018

delete-source is documented in help now, along with a warning:

delete-source:
Remove an add-source dependency; however, this will not delete the
package(s) that have been installed in the sandbox from this dependency. You
can either unregister the package(s) via cabal sandbox hc-pkg unregister
or re-create the sandbox (sandbox delete; sandbox init).

Given the direction of cabal, should that suffice to close this ticket?

@23Skidoo
Copy link
Member

23Skidoo commented Feb 7, 2018

OK, sure.

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

No branches or pull requests

8 participants