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: let preferUnplugged override pkg.conditions #4822

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jonaskuske
Copy link
Contributor

What's the problem this PR addresses?

fix #4749

How did you fix it?

Check manifest.preferUnplugged before checking pkg.conditions so it takes precedence

Checklist

  • 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.

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.

When conditions is set the contents of the manifest depends on which system you're on so this change isn't safe.

// Conditional packages may not be fetched if they're intended for a
// different architecture than the current one. To avoid having to be
// careful about those packages everywhere, we instead change their
// content to that of an empty in-memory package.
//
// This memory representation will be wrapped into an AliasFS to make
// it seem like it actually exist on the disk, at the location of the
// cache the package would fill if it was normally fetched.
const makeMockPackage = () => {
const zipFs = new ZipFS(null, {libzip});
const rootPackageDir = ppath.join(PortablePath.root, structUtils.getIdentVendorPath(locator));
zipFs.mkdirSync(rootPackageDir, {recursive: true});
zipFs.writeJsonSync(ppath.join(rootPackageDir, Filename.manifest), {
name: structUtils.stringifyIdent(locator),
mocked: true,
});
return zipFs;
};

@jonaskuske
Copy link
Contributor Author

@merceyz I'm not sure whether you mean that the general change of respecting preferUnplugged over conditions again is unsafe and not compatible with Yarn's goals, or that my implementation is unsafe and needs to be fixed?

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.

[Bug?]: prefersUnplugged should take precedence over pkg.conditions
2 participants