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 crash case #6062

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix crash case #6062

wants to merge 3 commits into from

Conversation

lukeapage
Copy link

What's the problem this PR addresses?

I raised a bug about deduping patch's (#6055) and thought the crash in yarn was about the patch, but it was not.

This change stops yarn crashing.

How did you fix it?

The problem is that alot of dependencies reference node-gyp with npm:latest.
The latest version in my yarn.lock file is 9.0.0, but yarn is finding the latest available to be 10.0.0.

So in getSatisfying, the descriptor is this:

{
  identHash: 'c463d28440264a050b6c82da90fae465d199a53c829a9fe2e382b672d4cbe014f84892bf0c630287a36347a4e407d33459c9581068c99d313332886ced75b781',
  scope: null,
  name: 'node-gyp',
  descriptorHash: '899f4448539abee8008ed64335a3b2bfb86e39a574e1267d2582a99b0865c3b00672068397645824a04ed0141f7f43c439ae8248539b250f8c76e24831ed0b94',
  range: 'npm:latest'

and makeDescriptor returns:

{
  identHash: 'c463d28440264a050b6c82da90fae465d199a53c829a9fe2e382b672d4cbe014f84892bf0c630287a36347a4e407d33459c9581068c99d313332886ced75b781',
  scope: null,
  name: 'node-gyp',
  descriptorHash: '48708ce70bc76e1f879f77affa6f744312cff313a2af15712d70a94f1b5e9382a4e1566ac8a75fb8c82ddbad727beca280bb7610d278c54b8c2d6ccbab77d231',
  range: 'npm:10.0.1'
}

but I guess because v10.0.1 is not in my yarn.lock file, getCandidates returns [] so resolvedLocator is undefined and yarn crashes.

I don't really know what I am doing so please feel free to suggest a different fix.

Checklist

  • I have read the Contributing Guide.

  • I have set the packages that need to be released for my changes to be effective.

  • I will check that all automated PR checks pass before the PR gets reviewed.

@lukeapage
Copy link
Author

@arcanis please could you help telling me how I can get this reviewed?

Copy link
Member

@merceyz merceyz left a comment

Choose a reason for hiding this comment

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

@lukeapage
Copy link
Author

@merceyz can you give any pointers on how to reproduce this situation? I need to define a yarn.lock file that has only v9 in it, bur yarn needs to be aware that a v10 exists and the package.json needs to ask for latest.. I feel like it would take me weeks to understand how this test code works.. I was able to make a fix by reproducing locally and debugging the place yarn crashed but as I said in the PR, I'm not familiar with what satsifying descriptors are etc.

@lukeapage
Copy link
Author

(I did look at the tests and setup, but it seems to be for simpler cases than what I am trying to reproduce)

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

3 participants