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

Fix GitFetcher.fetchFromLocal using wrong hash #3527

Merged
merged 1 commit into from
Jun 2, 2017

Conversation

Ngo-The-Trung
Copy link

@Ngo-The-Trung Ngo-The-Trung commented May 30, 2017

Found on 0.25.3

Following up #3449

expectHash is used beforehand to generate the cache destination, but actualHash is returned. This causes future cache destination path generation to use the wrong hash, resulting in EOENT errors.

@bestander

Full story:

PackageFetcher generates dest parameter using Config.generateHardModulePath before fetching using expectHash i.e. the commit hash

GitFetcher returns actualHash (i.e. tarball hash) as result of fetch

Some time later updateManifest is called with the fetch result hash (actualHash)

This pollutes the resolved patterns cache (PackageResolver.patterns) with the wrong hash (actualHash)

Future Config.generateHardModulePath calls getResolvedPattern and gets actualHash, (as opposed to expectHash. This causes it to look for the cached package in the wrong directory.

@bestander bestander requested a review from arcanis May 30, 2017 11:14
@bestander
Copy link
Member

@arcanis, this is for you to review

Copy link
Member

@arcanis arcanis left a comment

Choose a reason for hiding this comment

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

It unfortunately doesn't pass the flow check :/ I think you can use an invariant call to refine expectHash, that should be fine (I think the git resolution should always return a commit hash).

Following up yarnpkg#3449
expectHash is used beforehand to generate the cache destination, but
actualHash is returned. This causes future cache destination path
generation to use the wrong hash, resulting in EOENT errors.
@Ngo-The-Trung
Copy link
Author

@arcanis fixed

@arcanis arcanis merged commit bebe4cc into yarnpkg:master Jun 2, 2017
@arcanis
Copy link
Member

arcanis commented Jun 2, 2017

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.

3 participants