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

copyStorePath: Fix hash errors when copying from older store #2494

Merged
merged 1 commit into from Oct 29, 2018

Conversation

FPtje
Copy link
Contributor

@FPtje FPtje commented Oct 27, 2018

This commit partially reverts 48662d1. When
copying from an older store (in my case a store running Nix 1.11.7), nix would
throw errors about there being no hash. This is fixed by recalculating the hash.

From the Nixcon 2018 hackathon

};
};
MyStringSink sink(progress);
srcStore->narFromPath({storePath}, sink);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this will cause the NAR to be copied twice (due to the later call to narFromPath). You could create a StringSource for sink.s and pass it to dstStore->addToStore().

BTW I think the whole progress stuff can be removed here since this is just a backward compatibility path.

This commit partially reverts 48662d1. When
copying from an older store (in my case a store running Nix 1.11.7), nix would
throw errors about there being no hash. This is fixed by recalculating the hash.
@FPtje
Copy link
Contributor Author

FPtje commented Oct 29, 2018

I've force pushed the following changes to the code:

  • Fixed NAR being copied twice by indeed creating a StringSource for sink.s and passing it to dstStore->addToStore(). Thanks for helping me along the way there. I'm not familiar with the Nix code base, and your hint sent me along the right path.
  • Removed the progress stuff.
  • Removed FIXME comment, as it now seems to be properly fixed

I've tested by copying things to and from a Nix 1.11.7 store and to and from a nix 2.0.4 store.

@edolstra edolstra merged commit 056c3fb into NixOS:master Oct 29, 2018
@edolstra
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants