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 --frozen-lockfile not preventing lockfile changes #3497

Closed
wants to merge 2 commits into from

Conversation

gpoole
Copy link

@gpoole gpoole commented May 25, 2017

Summary

Fixes an issue where Yarn would rewrite yarn.lock instead of failing when --frozen-lockfile was used.

Fixes #3313.

Test plan

Added a test which checks the expected behaviour.

@gpoole gpoole changed the title Add failing test Fix --frozen-lockfile not preventing lockfile changes May 25, 2017
@@ -337,7 +337,7 @@ export class Install {
return false;
}
const match = await this.integrityChecker.check(patterns, lockfileCache, this.flags);
if (this.flags.frozenLockfile && match.missingPatterns.length > 0) {
if (this.flags.frozenLockfile && (match.missingPatterns.length > 0 || match.integrityError)) {
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately that is not the fix.
integrityError can just mean that node_modules was corrupted.

@bestander
Copy link
Member

Thanks for the attempt, @gpoole.
The issue is deeper, since 0.23 Yarn started optimizing the lockfile during installs and this causes the changes.
We need to make sure lockfile does not change when install runs if it satisfies the package.json.
The issue is somewhere in the resolver.

@gpoole
Copy link
Author

gpoole commented May 26, 2017

That makes sense @bestander, it did seem like that's what was happening for me. I am seeing a lockfile error (LOCKFILE_DONT_MATCH) in when I run it against real projects that have this problem, but looks like the test is failing here so that's obviously not it. Is the integrity checker not comparing the newly generated structure with the original one read from the file?

@bestander
Copy link
Member

bestander commented May 26, 2017 via email

@gpoole gpoole closed this Jun 8, 2017
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.

2 participants