-
Notifications
You must be signed in to change notification settings - Fork 704
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
cabal v2-install does not re-register a package unregistered by ghc-pkg #6508
Comments
I'm having the same issue on 3.4.0.0. I fixed it by deleting the corresponding |
Oh, interesting. Does it look like ghc-pkg bug (doesn't remove .lock file) or cabal bug (should ignore .lock or at least look also elsewhere)? |
I don't think this is a bug. Why OP is poking cabal store manually with |
IIRC There is somewhat related issue, #6060, with an idea that
I think this issue can be closed as invalid. |
@phadej: thank you very much for your input. I thought ghc-pkg and cabal are intended to work together without any restrictions, but from what you say, cabal treats ghc-pkg as its internal command that should be not invoked by users. Good to know. @demokritos, @Tritlo: how can we help you with your workflows that involve manual invocation of ghc-pkg? E.g., would cabal-env from the repo @phadej mentioned (https://github.com/phadej/cabal-extras/tree/master/cabal-env) let you work without using ghc-pkg directly? Does any other workflow similar to those from comments in #6481 suffice? Or are your needs completely different? |
Ideally: I'm installing a local version of my own packag that I want to have in global scope, and |
if the use case is "reinstall" a package from the cabal store (and it seems so to me from the initial description) my way to go is:
It is not completely satisfactory but it works for me. So I woul like ask reporters why did they have to reinstall the package (to tackle the root issue) and offer the workaround described above |
Just for reference, as I understand it, ghc-pkg doesn't work well with the v2 store because the v2 store basically uses a bunch of semi-documented/proprietary extensions to the package database that ghc-pkg hasn't been taught about. v1 was built over an existing ghc-pkg, but v2 was built in turn on top of ghc-pkg, and it was never in the design for the store to interact with ghc-pkg. Further, the ghc team isn't particularly interested in extensions ghc-pkg to do much with the v2 store. So any further work on extensions to v2-store functionality needs to be built into cabal-install itself. |
@jneira that's a good workaround, but requires me to manually find a directory in the cabal store and delete it (including figuring out the hash), and an addtional tool. I'm personally not versed well enough in |
A simple solution would be to provide an --overwrite flag for installing a particular individual package into the store. Even with Note that this has sort of the same issue as deleting a package from the store though, in that what happens if other packages in the store depended on this package and now its deleted or changed? Now they're broken in a way cabal can't know/see. Another stray thought -- A different approach might be to say that when installing a local package into the store it should be hashed not only by the usual version/flags/etc parameters but also by an actual pick-your-hash of its actual tarball or source-dir. That seems the safest and most sound thing to do overall, assuming the hashing-in-store mechanism is flexible enough to allow it. But then of course if someone else depends on the package, how do they know what hash to pick... :-) |
Yeah, it involves some manual steps. However, as commented above, reinstall a package should not be needed if everything works so, what is the cause you need reintall it? Maybe we could attack the root issue and resolve it better. Thanks to @gbaz i've remember another awful step in the process of manually reinstall a package:
But it reveal the insightful @gbaz considerations (i will rephrase them):
So we should consider carefully add those changes. As i mentioned above, if we can tacke the root issues causing the need of remove or reinstall packages we will get two improvements for free.
|
@jneira That would be great! But in the mean time, at least give a more informative message. Right now it says "up to date" when you try to reinstall the unregistered package, but then the package cannot be resolved. Maybe check for the lock file and the actual directory itself on installation, and print a warning about a broken store? |
What phadej said above is entirely correct. It's not a bug. Corrupting the store (by unregistering packages from the ghc pkg db) will result in sadness. Don't do that.
I don't think it uses any semi-documented/proprietary extensions. The ghc package db within the store is a perfectly ordinary ghc package db. Cabal uses ghc-pkg to update and read the package db. The point is that the overall cabal store is the combination of a lot of files (with a specific layout) and also a ghc package db. There are consistency rules, and cabal doesn't expect other tools to go and modify the store (and certainly not without respecting those rules). To delete a package from the store the process would be: delete the installed package directory, delete the corresponding file within the |
... and all the transitive reverse dependencies. i.e. so Don't poke with store manually. Only |
Describe the bug
If a package is unregistered by ghc-pkg, cabal v2-install does not register the package again.
v2-install seems to check the package directory in the store, but not package db.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The package should be re-added in the package db.
System information
cabal
,ghc
versions : cabal-install version 3.0.0.0compiled using version 3.0.0.0 of the Cabal library
The text was updated successfully, but these errors were encountered: