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

cabal freeze should take current cabal.config in the account #2519

Closed
gracjan opened this issue Apr 3, 2015 · 7 comments
Closed

cabal freeze should take current cabal.config in the account #2519

gracjan opened this issue Apr 3, 2015 · 7 comments

Comments

@gracjan
Copy link

gracjan commented Apr 3, 2015

Scenario:

  1. Create my-package.cabal, add some dependenciens.
  2. Freeze versions of dependencies with cabal freeze.
  3. Add some more dependencies to my-package.cabal.
  4. Use cabal freeze to fill in exact versions of new dependencies.

Expected:

In 4 cabal freeze fills in the missing information taking current cabal.config in account.

Current:

In 4 cabal freeze resolves packages from scratch producing a new list of package versions that is effectively random and has no relation to anything project related.

(Note about 'effectively random': resolved packages depend on last 'cabal update'. What 'cabal update' fetches is out of control and is a good source of entropy. Hence: random).

@23Skidoo
Copy link
Member

23Skidoo commented Apr 3, 2015

/cc @benarmston

@benarmston
Copy link
Contributor

When freeze was first written it was decided that it should always try to
update the frozen packages. That is it should ignore the cabal.config file.
I didn't like that behaviour but implemented it anyway. And without an
option to change it. My bad :-(

I think we should at least have an option to use the cabal.config file and
probably do so by default. We would also have to consider how this would
interact with preferring installed packages or not.
On 3 Apr 2015 13:07, "Mikhail Glushenkov" notifications@github.com wrote:

/cc @benarmston https://github.com/benarmston


Reply to this email directly or view it on GitHub
#2519 (comment).

@gracjan
Copy link
Author

gracjan commented Apr 3, 2015

Currently cabal install --only-dep does version resolution. cabal configure also does version resolution, probably using some other mechanism. cabal freeze also does version resolution taking some of the data into account and skipping other sources.

Version resolution takes into account what is installed, mostly. Sometimes it takes selected compiler version in account. If it is not installed then guesses something somehow, hard to know. There are silent discrepancies between 'don't have a sandbox', 'have a sandbox' and 'have a sandbox with installed packages' and 'have a sandbox with installed packages for different compiler'.

Add also that cabal-install needs to be of large enough version to even look at cabal.config but you cannot put 'cabal-version: > 1.20' because this makes project silently depend on 'Cabal > 1.20' but it will not install 'Cabal > 1.20' and you are in deployment hell.

Also: 'it was decided': can you point me when and who 'decided it'?

@benarmston
Copy link
Contributor

On 3 Apr 2015 14:35, "gracjan" notifications@github.com wrote:

Currently cabal install --only-dep does version resolution. cabal
configure also does version resolution. cabal freeze also does version
resolution taking some of the data into account and skipping other.

That's about right. There are multiple use cases for freeze and it
currently does a bad job for some (most?) of them. The hard part I think
is 1) identifying all of the use cases 2) figuring out a sane UI to
support them all and 3) finding time for all of this.

Version resolution takes into account what is installed. Sometimes takes
selected compiler version in account. If it is not installed then guesses
something somehow. There are silent discrepancies between 'don't have
'sandbox'', 'have sandbox' and 'have sandbox with installed packages'.

Could you explain these discrepancies better please?

Add also that cabal-install needs to be of large enough version to even
look at cabal.config but you cannot put 'cabal-version: > 1.20' because
this makes project silently depend on 'Cabal > 1.20' but will not install
'Cabal > 1.20' and you are in deployment hell.

I'm not sure I understand this point or at least not how it pertains to
freeze. Could you expand on it please?

Also: 'it was decided': can you point me when and who 'decided it'?

I can but it will have to be later. I'm on my phone at the moment and don't
want to try to trawl through github issues to find it.


Reply to this email directly or view it on GitHub.

@gracjan
Copy link
Author

gracjan commented Apr 3, 2015

Could you explain these discrepancies better please?

I guess there are many. Example:

  1. cabal sandbox init
  2. cabal install --only-dep -w ghc-7.6.3
  3. cabal configure -w ghc-7.6.3
  4. cabal freeze

Expected:

cabal freeze freezes based on what is inside sandbox

Actual:

cabal freeze ignores what is inside sandbox because it uses different compiler than install/configure steps

Solution:

cabal freeze should refuse to work if information is missing, unless given a command line option. Then, if there is something strange happening, user will be notified and can opt in for the 'guessing' part. Current default to 'I'll just guess!' is nondeterministic, leads to frustration and silent errors.

@aslatter
Copy link
Contributor

aslatter commented Apr 5, 2015

What happened to @gracjan burned me as well.

The example above is particularly frustrating because there is no -w option to freeze.

It caught me by surprise that cabal freeze re-invokes the solver - I'm not saying the original design was wrong, just not intuitive.

@ttuegel ttuegel added this to the cabal-install-1.24 milestone Apr 24, 2015
@23Skidoo 23Skidoo modified the milestones: cabal-install 1.24, cabal-install 1.26 Feb 21, 2016
@ezyang ezyang modified the milestone: cabal-install 2.0 Sep 6, 2016
@grayjay
Copy link
Collaborator

grayjay commented Jun 17, 2018

Closing as a duplicate of #2265.

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

7 participants