Skip to content

Spurious reinstallation of add-source'd dependencies #2667

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

Closed
bitemyapp opened this issue Jun 19, 2015 · 5 comments
Closed

Spurious reinstallation of add-source'd dependencies #2667

bitemyapp opened this issue Jun 19, 2015 · 5 comments

Comments

@bitemyapp
Copy link
Contributor

I'm trying to make something like an idempotent build process that doesn't rebuild any more than it needs to.

Problem I'm running into is that even if the vendored dependencies haven't changed, running:

cabal sandbox add-source ../blah

Will force reinstallation of blah even if it hasn't changed at all.

@dcoutts
Copy link
Contributor

dcoutts commented Jun 29, 2015

I've seen this too, it's a right PITA. We should really track it down. It's one of the items in #2631.

@bitemyapp can you make a recipe to reproduce it reliably?

@grayjay
Copy link
Collaborator

grayjay commented Jun 30, 2015

I spent some time on this issue. This causes the package to be installed twice:

cabal sandbox init
cabal sandbox add-source ../blah
cabal install --only-dependencies
cabal sandbox add-source ../blah
cabal configure
cabal build

add-source sets the timestamps for ../blah to 0 in .cabal-sandbox/add-source-timestamps, even if the directory is already listed. Then cabal treats the source as modified during the next build. #1331 changed add-source to allow it to overwrite existing timestamps. However, I don't know if the issues discussed in that PR and the associated issue (#1197) are still relevant. When I modified cabal to prevent overwriting timestamps, I couldn't reproduce the problems discussed in #1197. Does anyone know if it is safe to stop overwriting existing timestamps?

@23Skidoo
Copy link
Member

@grayjay I think that this solution should be OK. Please do a pull request, and I'll take a look. Note that you also need to support the following case:

$ cabal sandbox add-source /path/to/foo
$ cabal install --only-dependencies
$ cabal sandbox add-source /some/other/path/to/foo

@grayjay
Copy link
Collaborator

grayjay commented Jul 1, 2015

@23Skidoo I'm not sure how add-source is supposed to work in that case. Currently, it adds both directories to add-source-timestamps and the index. How should cabal determine which source to install later, if they both have the same package name and version?

As far as I can tell, cabal uses the source that was last added to the index. In your example, /some/other/path/to/foo is installed during the next build. But if I add /path/to/foo again, the package doesn't need to be added to the index, so it's not installed when I run cabal build. Handling adding a directory twice might require resetting its timestamp.

@phadej
Copy link
Collaborator

phadej commented Aug 31, 2020

sandbox functionality is removed.

@phadej phadej closed this as completed Aug 31, 2020
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

5 participants