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

Stack assumes IPIDs have a specific format #851

Closed
ezyang opened this issue Aug 25, 2015 · 6 comments
Closed

Stack assumes IPIDs have a specific format #851

ezyang opened this issue Aug 25, 2015 · 6 comments
Assignees

Comments

@ezyang
Copy link

ezyang commented Aug 25, 2015

parseGhcPkgId assumes that an installed package ID is always a package name, a version, and a hash. IPIDs are opaque identifiers generated by Cabal, and Cabal reserves the right to change them (and will be changing them soon, c.f. haskell/cabal#2745 )

@chrisdone
Copy link
Member

That issue didn't clarify for me what will become of the format, other than that it will change. Currently we parse (from ghc-pkg dump)

ghcpkgid = packageidentifier "-" hash

where packageidentifier = packagename "-" packageversion

From that module we export access to the packageidentifier (and therefore the name and version of the package), because those are used in the codebase, but we don't expose access to the hash, which is only available as part of the whole when printing or comparing the ghcpkgid data structure.

What will be the new format of the ghcpkgid? Will there be a name and version anymore? What can we expect? If this string will basically be an opaque hash (again, of what format?) with nothing useful in it but to be unique then we'll update the parser to be liberal and remove the packageidentifier accessor from the module and rework the codebase from the bottom up with this new change. If the packagename will remain but version not, we may still be able to recover the version from elsewhere in ghc-pkg dump, etc. Then having stack work on the recent GHC and the new GHC that uses this change is another issue.

@ezyang
Copy link
Author

ezyang commented Aug 26, 2015

OK, if it is a really big problem for Stack to fix this we can try to keep the full package identifier in the IPID (our change is mostly to the hash format, but we were considering dropping the version to keep symbol names small). However, shouldn't it always be possible to get the package name and version given an IPID by consulting ghc-pkg dump, for both new and old GHCs?

@chrisdone
Copy link
Member

It's not a really big problem, it's just vague. If a package id no longer contains anything but a hash, then a re-interpretation of the GhcPkgId type is needed, which will have some small ripples in the codebase. We'll just proceed like this, then it doesn't matter what format you pick in the end. 👍

@ezyang
Copy link
Author

ezyang commented Aug 27, 2015

OK, well, assuming symbol name sizes don't end up being a problem, it's not too hard to accommodate you guys by keeping the format the same (if you're fine with any sort of alphanumeric hash format).

@snoyberg
Copy link
Contributor

@ezyang What are the restrictions on what an IPID can be? Can it contain spaces? Non-Latin characters? From what I've seen, A-Za-z0-9 and - should be it. Is that accurate?

@snoyberg
Copy link
Contributor

snoyberg commented Sep 2, 2015

Pull request #902 opened to address this. I'm going to close this issue, let's discuss on the PR

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

3 participants