Skip to content

Forward compat story for cabal.project(.freeze)? #8142

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

Open
merijn opened this issue May 16, 2022 · 2 comments
Open

Forward compat story for cabal.project(.freeze)? #8142

merijn opened this issue May 16, 2022 · 2 comments

Comments

@merijn
Copy link
Collaborator

merijn commented May 16, 2022

So, 5 years ago, hvr wrote up a nice issue (#4899) on forward/backward compat for cabal file formats. Unfortunately, we seem to have immediately forgotten the lessons of this issue, because cabal.project(.freeze) is now in the same state as cabal files were back then. Newer cabal's (in my case 3.6) will happily produce files with an output that's not understood by older cabal versions, leading to cryptic errors when you try to build the same project with an older cabal.

Specifically, my 3.6 freeze file introduces the line: active-repositories: hackage.haskell.org:merge

Which on 3.2 produces the error:

cabal: Error parsing project freeze file
/home/mverstra/gpu/cabal.project.freeze:265:
Parse of field 'index-state' failed (index-state must be a unix-timestamps
(e.g. '@1474732068'), a ISO8601 UTC timestamp (e.g. '2016-09-24T17:47:48Z'),
or 'HEAD'): hackage.haskell.org 2022-05-13T07:41:48Z

Ideally we'd get some userfriendly error reporting for cases like this, which would require some form of forward compat (i.e. old cabal's being able to determine a project/freeze file is too new for them) approach. Especially since I can imagine further compat breaking changes going forward with all the plans to integrate conditionals/snapshots/etc.

@Mikolaj
Copy link
Member

Mikolaj commented May 16, 2022

I think we haven't completely forgotten the lesson and we place an extra burden on developers to keep the .cabal files backward and forward compatible via a system of explicit file format versions, a recorded and automatically consulted changelog, etc. I guess we don't do this for project files, the ~/cabal/config file, freeze files nor anything else and, frankly, the burden could be too much. However, if you have a concrete proposal to improve the situation, ideally more light-weight, let's discuss.

@merijn
Copy link
Collaborator Author

merijn commented May 16, 2022

I didn't mean we forgot it for cabal files, but we finally had a robust setup for .cabal, and then we introduce a new filetype and didn't build similar infrastructure into it from the start.

~/.cabal/config shouldn't really need anything, since it corresponds to whatever cabal is on the local system, but cabal.project files don't necessarily. Freeze files in particular could have a version like cabal-version easily enough, since they're almost always generated by cabal (I don't think anyone is handwriting freeze files, neither are they expected to).

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

2 participants