fixed crash when printing latest versions with 'cabal install' #1018

Merged
merged 1 commit into from Aug 28, 2012

2 participants

@soenkehahn

A recent patch introduced the feature that 'cabal install --dry-run' would print latest version numbers for packages to be installed. This failed if the package that was installed (the actual target, not a dep) wasn't uploaded to hackage:

cabal: Prelude.last: empty list

This patch fixes this.

(This is my first patch to cabal. If I did violate some coding or other guidelines, please tell me!)

@byorgey

Is lookupPackageName really guaranteed to return packages in version order?

Hmm... aha, I see that it is, according to https://github.com/haskell/cabal/blob/master/cabal-install/Distribution/Client/PackageIndex.hs#L99, but this really ought to be better documented...

The last was introduced in the previous patch. I don't know about lookupPackageName.

Haskell member

Right, I know last was from the previous patch, I just hadn't looked at the previous patch carefully so commented here. In any case, all is well.

Haskell member

Also, when I said "this ought to be better documented", I meant in Distribution.Client.PackageIndex, not here.

I see. Indeed, all is well. Thanks for merging.

@byorgey byorgey merged commit 47f280e into haskell:master Aug 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment