Skip to content

stack unpack downloads deprecated package versions #1391

Closed

Description

@borsboom
Steps to reproduce:

Run stack unpack stack

Expected:

It unpacks the latest non-deprecated version (as of this filing, stack-0.1.8.0).

Actual:

It unpacks stack-9.9.9, which is deprecated and unbuildable.

$ stack unpack stack
stack-9.9.9: download
Unpacked stack-9.9.9 to /Users/manny/fpco/tmp/stack-9.9.9/

Activity

  1. added this to the P2: Should milestone on Nov 21, 2015
  2. DNNX commented on Nov 22, 2015

    @DNNX
    Contributor

    I just scanned hackage index trying to find what other packages are affected. As it turns out, at the moment 15 out of 9069 packages have max deprecated-versions >= max non-deprecated-versions. In other words, stack unpacking any of those 15 packages would download a deprecated version:

    call    0.2
    fptest  0.2.2.0
    hydrogen-cli-args   0.9
    hydrogen-data   0.7.1
    hydrogen-prelude    0.9
    hydrogen-syntax 0.7.1
    json-autotype   1.0.9
    leksah-server   0.8.0.8
    leksah  0.8.0.8
    ltk 0.8.0.8
    peyotls-codec   0.3.1.1
    pipes-cereal    0.1.0.0
    sasl    0.0.0.2
    stack   9.9.9
    word12  1.0.0
    

    I hope it will be useful for anyone who decides to fix this bug (at least for testing).

    I initially wanted to fix it myself, but it seems that it is not that trivial. We need to either make a request to Hackage API each time a user runs stack unpack, or enrich the package index with information about package deprecations in order to have it at our disposal at runtime. Currently package index just don't have this info. As far as I understand, package index is created by another tool (not stack), so maybe another issue should be created in that tool's Github repo as well.

  3. mgsloan commented on Nov 22, 2015

    @mgsloan
    Contributor

    Hmm, it's surprising to me that stack unpack would unpack the latest version rather than the snapshot version. Maybe that's a good way to fix this? Granted, that doesn't help for the packages that aren't in the snapshot / when you're using a compiler resolver.

  4. borsboom commented on Nov 22, 2015

    @borsboom
    ContributorAuthor

    Yeah, I could go either way on this. Not really clear to me whether it's preferable to use the latest version or the snapshot version, so I'd tend toward staying with the current behaviour unless there's a compelling reason to change it (and I'm not sure that this issue qualifies as compelling enough).

    I just confirmed that the package index in ~/.stack/indices/Hackage/00-index.tar does include the preferred-versions file (e.g., in stack/preferred-versions), and so does the all-cabal-hashes repo ((e.g., stack's preferred-versions).

  5. luigy commented on Dec 8, 2015

    @luigy
    Contributor

    hmm there are a couple ways mentioned above to approach this

    Z. query hackage api each time
    all the information needed should already be present so I'm not to fond of this, but it is def the simplest

    S Z. extend package-cache map to contain this information
    Currently a package-cache is keyed by package-indentifier, but preferred-versions applies to the whole package. Perhaps something like this? - not too familiar if this will cause significant performance regression

    newtype PackageCacheMap 
          = PackageCacheMap (Map PackageName (Maybe PreferredVersions, Map Version PackageCache))

    also from skimming the code looks like a change like this will rebuild cache correctly once users upgrade

    and maybe have a flag to support @mgsloan comment on fetching it using the snapshot?

  6. tolysz commented on Dec 10, 2015

    @tolysz
    Collaborator

    Just playing with the stack --stack-yaml some/stack.yaml unpack some-package
    It looks like it ignores the version specified inside the .yaml (in my case in the packages section) and it just takes some random one, possibly, latest.

  7. mgsloan commented on Dec 11, 2015

    @mgsloan
    Contributor

    @tolysz Good point. The case of unpacking a local package (in particular, location: git) makes me think that stack unpack should default to unpacking the version specified by the stack.yaml. Then we can add a stack unpack --latest command to get the current behavior.

    I'm thinking it's fine to change the meaning of stack unpack, since I doubt it gets much use in scripts. It'd probably be good to have the command output clearly state when it's not unpacking the latest version, though, incase folks still expect that.

  8. tolysz commented on Dec 11, 2015

    @tolysz
    Collaborator

    Or even stack unpack --hackage ...

  9. mgsloan commented on Dec 12, 2015

    @mgsloan
    Contributor

    I prefer --latest over --hackage, because all the packages come from hackage.

  10. Ericson2314 commented on Feb 23, 2016

    @Ericson2314

    I prefer --latest over --hackage, because all the packages come from hackage.

    Not if stack.yaml specifies otherwise.

  11. Ericson2314 commented on Feb 23, 2016

    @Ericson2314

    For ghcjs/ghcjs#442 @luigy had the excellent idea of using stack unpack as an initial step to leverage Stack in the boot process. For us to do that however, this needs to be fixed. Any pointers on where to begin?

  12. 6 remaining items

  13. Ericson2314 commented on Feb 24, 2016

    @Ericson2314

    Since stack.yaml doesn't make one list which cabal files are in which locations, I think the code I listed does some searching. To be fair I'm fine with any sort of default, but I hope everyone would agree that there should be at least an option to unpack the version stack would build in practice.

  14. Ericson2314 commented on Feb 24, 2016

    @Ericson2314

    @luigy if you want to take it it would be very much appreciated. All this GHCJS is some serious yack-shaving on my capstone project for school I'm worried I should soon be getting back too. :)

  15. mgsloan commented on Feb 24, 2016

    @mgsloan
    Contributor

    I'd be open to adding some code to stack for the purpose of supporting ghcjs-boot's usecase, ideally remaining as generic as possible.

  16. rrnewton commented on Apr 18, 2016

    @rrnewton
    Contributor

    (CC @RyanGlScott, @vollmerm)
    We just came across the stack unpack behavior and were surprised that it was ignoring our stack.yaml.

    Likewise, we expected to be able to pass --resolver=lts-5.13 to force it, as most of the stack commands we use respect --resolver. But that wasn't an option.

    Reading this issue it sounds like there's some consensus around giving stack the ability to unpack stack-dictated package versions.

  17. mgsloan commented on Apr 18, 2016

    @mgsloan
    Contributor

    Agreed that we really should make this change. Hopefully we can get #1858 finished up for this release.

  18. tolysz commented on Aug 28, 2016

    @tolysz
    Collaborator

    Ideally, we would need to get the latest revision of .cabal for a given version.

  19. mgsloan commented on Sep 26, 2016

    @mgsloan
    Contributor

    We don't want to use the latest revisions, because that can make stack builds non reproducible.

  20. mgsloan commented on Oct 24, 2016

    @mgsloan
    Contributor

    NOTE: Existing work

    The PR for this has languished for a long time, so I've closed it - https://github.com/commercialhaskell/stack/pull/1839/files . Future efforts should use this as reference, as a lot of work already got done by @luigy here.

    One thing to note that that PR doesn't do is to also consider extra-deps. Hopefully with the implementation of #1265 there will be a straightforward way to implement a query of "What is the package version specified by a given stack.yaml configuration"

  21. snoyberg commented on Mar 20, 2019

    @snoyberg
    Contributor

    This has already been fixed in Stack, closing.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions