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

Index cache not invalidated (after add-source) #1213

Closed
etrepum opened this issue Feb 20, 2013 · 2 comments
Closed

Index cache not invalidated (after add-source) #1213

etrepum opened this issue Feb 20, 2013 · 2 comments

Comments

@etrepum
Copy link
Contributor

etrepum commented Feb 20, 2013

The cabal-dev test suite ran into an issue where the following sequence of events happened quickly creswick/cabal-dev#74 (comment)

  • Create an empty index (creates 00-index.tar)
  • install a package that does not exist (creates 00-index.cache)
  • add-source a package (updates 00-index.tar, but not 00-index.cache)
  • install a package that now exists (reads invalid 00-index.cache and fails)

The reason this fails is because file modification times have a granularity of seconds, and on a modern machine that's simply not precise enough to reliably order events. I haven't dug in to cabal's code very much, but it seems to make the incorrect assumption that just updating the tar file will reliably invalidate the cache.

An easy way to more reliably invalidate the cache would be to just delete the cache file whenever the tar is updated. This would not require any change of the file formats and should be minimally invasive.

@23Skidoo
Copy link
Member

add-source a package (updates 00-index.tar, but not 00-index.cache)

Looking at cabal-dev's source, I see that it manipulates the index file directly using Codec.Archive.Tar. IMO, this makes it a cabal-dev bug - addSources should be deleting the cache after having successfully executed writeIndex.

@etrepum
Copy link
Contributor Author

etrepum commented Feb 21, 2013

Mea culpa. I'll put together a different PR for cabal-dev and close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants