You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
improve dist/setup-config format mismatch detection #2251
I was having this weird issues with the devel version of cabal where some cabal invocations would fail with the following rather non-obvious error message
cabal: Prelude.chr: bad argument: 2041223
Even with -v3 this is the very first output you get from cabal. Only strace provided the hint that setup-config was the last file read before that error message was emitted.
(the underlying problem was most likely that cabal had been compiled against an older snapshot of the Cabal lib than the Cabal lib snapshot registered in the pkg db. And those two snapshots probably disagreed on the setup-config schema)
In the previous text based format we included info about the version of Cabal that wrote it and reported an appropriate message if the version did not match (and iirc, that was one of the cases where we'd automatically reconfigure).
@dcoutts
We still do this, but new code is probably less robust when the Cabal snapshot changes, but the version number doesn't. Maybe the header should also include Git revision ID.
The new code should be more robust to format changes, in the sense that binary returns errors explicitly rather than throwing exceptions. I think the problem here is that the header format changed; now we use a binary version header. I suspect this happens when a pre-binary-setup-config Cabal tries to read the binary header. I think we should switch back to the old header format; the new format still won't be backward compatible, but we will produce meaningful error messages. If we keep the old header format, we can be forward-compatible with the text setup-config format (eliminating the need to cabal configure explicitly when upgrading from text to binary; see #2214). The cost is breaking the format for anyone using a git checkout of Cabal (they will have to reconfigure manually; a small cost for an unreleased mistake).
I think we should switch back to the old header format;
+1 on this.
I suspect this happens when a pre-binary-setup-config Cabal tries to read the binary header.
I think I had this happen to me with a new Cabal, but I don't know how to reproduce (the problem went away after a reconfigure). It'd help if someone could attach a setup-config file that exhibits this behaviour.
+1 on better handling of version mismatches. i like the idea of sticking with the old header format and automatically reconfiguring.
I've also been seeing this type of error a lot, working with recent cabal versions. I know how to fix it, but it's probably going to bite lots of users, in particular in mixed cabal version setups (and i'll have to keep asking ghc 7.8 users to upgrade their cabal library to use ghcjs)
One of my colleagues is actually getting this bug with building Cabal head itself
Interestingly enough, the problem reported by@edsko recently started happening on Travis with 7.10. What I don't get is why build fails to read back the setup-config file - both build and configure (which generated it) use the internal setup method, so the versions of binary should match. @ttuegel, any ideas?
The current situation is quite frustrating: I can either ignore failures with 7.10 and 1.22 via allow_failures (bad, because I might not catch problems, and both versions should be out soon) or I have relatively random failures in my build matrix (bad, too, for the obvious reasons).
Cabal and cabal-install must always have the same major version, in this case 1.22.y.z. Releases with the same major version must be compatible, i.e. Cabal-1.22.u.v is compatible with cabal-install-1.22.y.z for all u, v, y, z. It is always best to use the latest minor release, as that will have the most recent bug fixes. Right now that is Cabal-1.22.1.1 and cabal-install-1.22.0.1. That means you should be updating cabal-install every time Cabal is updated. Travis does not do this, and so it is broken right now.
@23Skidoo The proximate cause of that error is Travis not using cabal-install built with the latest Cabal. Not sure yet why it insists on reconfiguring, but we would get a more meaningful explanation if Travis used the latest Cabal.
What's interesting is that the same version of cabal-install is used in all cases (7.4.2, 7.6.3, 7.8.3, ...), but the exception only happens with HEAD and 7.10. I wonder whether this has something to do with the 7.10 snapshot reporting its version as 7.10.0.20150314 (HEAD uses 7.11.20150314). Maybe this triggers some bug in the Data.Version Binary instance?
The proximate cause of that error is Travis not using cabal-install built with the latest Cabal.
I understand that it doesn't include your fix (#2428) for the uncaught exception problem, which is why we get Prelude.chr: bad argument: instead of Reconfiguring with default arguments.... But I don't understand why we get an exception in the first place: setup-config was generated by the same cabal-install executable that tries to read it back, versions of Cabal and binary should match.
Hmmm, even after all those explanations my question remains: What shall I (and lots of other people) do to get their Travis builds green again? I don't fully understand the details yet, but having to do seemingly unrelated things in lockstep is a horrible user experience, and this should mitigated somehow. In the C/C++ world: Imagine if gcc/make/rpm/... would have to be kept tightly in sync somehow... 😱
@svenpanne I'm not sure what you mean by keeping things in lockstep here. The bug is fixed in Cabal-1.22.1.1. Travis does not use this version, so you do not get the bug fix. That's the extent of the problem blocking builds.
There is an unrelated issue that cabal-install sometimes reconfigures when it doesn't need to. In Cabal < 1.22.1.1, this also triggers the Prelude.chr bug, but if Travis updated their Cabal, your builds would still succeed. (Albeit after reconfiguring unnecessarily.) The bug fix will also be available in GHC 7.10.1-rc3, so if/when Travis updates to that, you'll be good to go.
There is an unrelated issue that cabal-install sometimes reconfigures when it doesn't need to. In Cabal < 1.22.1.1, this also triggers the Prelude.chr bug
I don't think that the reconfigure logic is at fault. The Main.reconfigure function reconfigures only if necessary. buildAction unconditionally calls reconfigure, which tries to load setup-config with tryGetPersistBuildConfig, which raises the Prelude.chr exception.
Just to clarify: The only missing thing to get Travis CI builds with 7.10 green again is a new version (1.22.1.1) of cabal-install in https://launchpad.net/~hvr/+archive/ubuntu/ghc, correct? GHC seems to be updated quite regularly there, but not cabal-install. Can we somehow arrange to get that soon? 7.10 is already at release candidate 3, and I haven't been able to get consistently green builds for that.
Given the heavy reliance of lots of packages on Travis CI (not only mine), we should probably have some automated PPA where there relevant packages (GHC, cabal-install, etc.) live.
@23Skidoo Well, I know that, and I think Herbert is really doing a great job, but he's probably overloaded with work, so he couldn't update the PPA. My proposal was to replace that "single point of failure" for all those Haskell projects using Travis CI with something automatic, i.e. have a PPA somewhere with GHC, cabal-install etc. on it.
I don't think that the reconfigure logic is at fault. The Main.reconfigure function reconfigures only if necessary. buildAction unconditionally calls reconfigure, which tries to load setup-config with tryGetPersistBuildConfig, which raises the Prelude.chr exception.
I think you're right. I just checked, and the setup-config files created during the configure and build runs are byte-for-byte identical. I suspect a bug in binary or one of our instances.
Activity
23Skidoo commentedon Dec 2, 2014
/cc @ttuegel
dcoutts commentedon Dec 2, 2014
In the previous text based format we included info about the version of Cabal that wrote it and reported an appropriate message if the version did not match (and iirc, that was one of the cases where we'd automatically reconfigure).
hvr commentedon Dec 2, 2014
fwiw, @svenpanne experienced this issue some time ago too: https://www.haskell.org/pipermail/ghc-devs/2014-October/006962.html
23Skidoo commentedon Dec 2, 2014
@dcoutts
We still do this, but new code is probably less robust when the Cabal snapshot changes, but the version number doesn't. Maybe the header should also include Git revision ID.
23Skidoo commentedon Dec 2, 2014
For those who come here by googling the error message: to fix this issue, just delete
dist/setup-config.ttuegel commentedon Dec 2, 2014
The new code should be more robust to format changes, in the sense that
binaryreturns errors explicitly rather than throwing exceptions. I think the problem here is that the header format changed; now we use a binary version header. I suspect this happens when a pre-binary-setup-configCabal tries to read the binary header. I think we should switch back to the old header format; the new format still won't be backward compatible, but we will produce meaningful error messages. If we keep the old header format, we can be forward-compatible with the textsetup-configformat (eliminating the need tocabal configureexplicitly when upgrading from text to binary; see #2214). The cost is breaking the format for anyone using a git checkout of Cabal (they will have to reconfigure manually; a small cost for an unreleased mistake).23Skidoo commentedon Dec 2, 2014
@ttuegel
+1 on this.
I think I had this happen to me with a new Cabal, but I don't know how to reproduce (the problem went away after a reconfigure). It'd help if someone could attach a
setup-configfile that exhibits this behaviour.@hvr
Which version of
cabal-installare you using?hvr commentedon Dec 2, 2014
@23Skidoo
The
cabal-installexecutable was generated fromhttps://launchpad.net/~hvr/+archive/ubuntu/ghc/+sourcepub/4539223/+listing-archive-extra
(i.e. 7ece59b) whereas the
Caballibrary gitlinked in GHC HEAD (and thus registered in the pkg-db) is currently at 6c395bb23Skidoo commentedon Dec 2, 2014
@hvr
Thanks. So this is a version that includes the binary
setup-configpatches.luite commentedon Dec 3, 2014
+1 on better handling of version mismatches. i like the idea of sticking with the old header format and automatically reconfiguring.
I've also been seeing this type of error a lot, working with recent cabal versions. I know how to fix it, but it's probably going to bite lots of users, in particular in mixed cabal version setups (and i'll have to keep asking ghc 7.8 users to upgrade their cabal library to use ghcjs)
svenpanne commentedon Dec 3, 2014
I just triggered a rebuild for one of my projects, and things seem to work now: https://travis-ci.org/haskell-opengl/StateVar/jobs/40772431 @hvr: Have the Ubuntu packages been updated?
The only funny thing is the warning https://travis-ci.org/haskell-opengl/StateVar/jobs/40772431#L96 ("Warning: /tmp/pkgConf-StateVar-1.0.12205.0: Unrecognized field data-dir on line 19"). Not a show-stopper, but I really try to keep all builds warning-free, so what's going on there?
luite commentedon Dec 3, 2014
data-diris a new field inInstalledPackageInfo:7fa8f88
I think the
Caballibrary shipping with GHC is still too old to include this change.32 remaining items
ttuegel commentedon Feb 20, 2015
It is unexpected and avoidable, but technically correct (impossible to catch exceptions in pure code). I have submitted a patch.
23Skidoo commentedon Mar 16, 2015
Interestingly enough, the problem reported by @edsko recently started happening on Travis with 7.10. What I don't get is why
buildfails to read back thesetup-configfile - bothbuildandconfigure(which generated it) use the internal setup method, so the versions ofbinaryshould match. @ttuegel, any ideas?#2428 should help, but why is it failing at all?
svenpanne commentedon Mar 16, 2015
I know that I'm probably repeating myself, but I have problems with GHC 7.10 and Cabal 1.22 for months now, too, see e.g.
https://travis-ci.org/haskell-opengl/GLURaw/jobs/53960254
https://travis-ci.org/haskell-opengl/StateVar/jobs/53657899
https://travis-ci.org/haskell-opengl/OpenGL/jobs/53853598
to name just a few. https://launchpad.net/~hvr/+archive/ubuntu/ghc contains only relatively old cabal-install 1.22 versions, so could somebody please clarify what the current state of affairs is? To be honest, I don't understand things anymore. 😕 Which versions are expected to work together? How can I test this on Travis CI?
The current situation is quite frustrating: I can either ignore failures with 7.10 and 1.22 via
allow_failures(bad, because I might not catch problems, and both versions should be out soon) or I have relatively random failures in my build matrix (bad, too, for the obvious reasons).ttuegel commentedon Mar 16, 2015
Cabal and cabal-install must always have the same major version, in this case
1.22.y.z. Releases with the same major version must be compatible, i.e.Cabal-1.22.u.vis compatible withcabal-install-1.22.y.zfor all u, v, y, z. It is always best to use the latest minor release, as that will have the most recent bug fixes. Right now that isCabal-1.22.1.1andcabal-install-1.22.0.1. That means you should be updating cabal-install every time Cabal is updated. Travis does not do this, and so it is broken right now.ttuegel commentedon Mar 16, 2015
@23Skidoo The proximate cause of that error is Travis not using cabal-install built with the latest Cabal. Not sure yet why it insists on reconfiguring, but we would get a more meaningful explanation if Travis used the latest Cabal.
23Skidoo commentedon Mar 16, 2015
What's interesting is that the same version of
cabal-installis used in all cases (7.4.2, 7.6.3, 7.8.3, ...), but the exception only happens with HEAD and 7.10. I wonder whether this has something to do with the 7.10 snapshot reporting its version as7.10.0.20150314(HEAD uses7.11.20150314). Maybe this triggers some bug in theData.VersionBinary instance?23Skidoo commentedon Mar 16, 2015
@ttuegel
I understand that it doesn't include your fix (#2428) for the uncaught exception problem, which is why we get
Prelude.chr: bad argument:instead ofReconfiguring with default arguments.... But I don't understand why we get an exception in the first place:setup-configwas generated by the samecabal-installexecutable that tries to read it back, versions ofCabalandbinaryshould match.svenpanne commentedon Mar 16, 2015
Hmmm, even after all those explanations my question remains: What shall I (and lots of other people) do to get their Travis builds green again? I don't fully understand the details yet, but having to do seemingly unrelated things in lockstep is a horrible user experience, and this should mitigated somehow. In the C/C++ world: Imagine if gcc/make/rpm/... would have to be kept tightly in sync somehow... 😱
ttuegel commentedon Mar 16, 2015
@svenpanne I'm not sure what you mean by keeping things in lockstep here. The bug is fixed in Cabal-1.22.1.1. Travis does not use this version, so you do not get the bug fix. That's the extent of the problem blocking builds.
There is an unrelated issue that cabal-install sometimes reconfigures when it doesn't need to. In Cabal < 1.22.1.1, this also triggers the
Prelude.chrbug, but if Travis updated their Cabal, your builds would still succeed. (Albeit after reconfiguring unnecessarily.) The bug fix will also be available in GHC 7.10.1-rc3, so if/when Travis updates to that, you'll be good to go.23Skidoo commentedon Mar 16, 2015
@ttuegel
I don't think that the reconfigure logic is at fault. The
Main.reconfigurefunction reconfigures only if necessary.buildActionunconditionally callsreconfigure, which tries to loadsetup-configwithtryGetPersistBuildConfig, which raises thePrelude.chrexception.svenpanne commentedon Mar 17, 2015
Just to clarify: The only missing thing to get Travis CI builds with 7.10 green again is a new version (1.22.1.1) of cabal-install in https://launchpad.net/~hvr/+archive/ubuntu/ghc, correct? GHC seems to be updated quite regularly there, but not cabal-install. Can we somehow arrange to get that soon? 7.10 is already at release candidate 3, and I haven't been able to get consistently green builds for that.
Given the heavy reliance of lots of packages on Travis CI (not only mine), we should probably have some automated PPA where there relevant packages (GHC, cabal-install, etc.) live.
23Skidoo commentedon Mar 17, 2015
@svenpanne
That's up to @hvr, who maintains that PPA.
svenpanne commentedon Mar 17, 2015
@23Skidoo Well, I know that, and I think Herbert is really doing a great job, but he's probably overloaded with work, so he couldn't update the PPA. My proposal was to replace that "single point of failure" for all those Haskell projects using Travis CI with something automatic, i.e. have a PPA somewhere with GHC, cabal-install etc. on it.
ttuegel commentedon Mar 18, 2015
@23Skidoo
I think you're right. I just checked, and the
setup-configfiles created during the configure and build runs are byte-for-byte identical. I suspect a bug in binary or one of our instances.23Skidoo commentedon Mar 18, 2015
Looks like @hvr has updated his PPA or something; this problem no longer happens for
cabal-installon Travis.