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

[Bug] Infinite loop with mkdirp on n_m #541

Closed
arcanis opened this issue Oct 19, 2019 · 3 comments
Closed

[Bug] Infinite loop with mkdirp on n_m #541

arcanis opened this issue Oct 19, 2019 · 3 comments
Labels
bug Something isn't working node-modules unreproducible This issue cannot be reproduced on master

Comments

@arcanis
Copy link
Member

arcanis commented Oct 19, 2019

Describe the bug

When operating from within a PnPify environment the node_modules folder exists, but creating a folder inside it (in particular node_modules/.cache) isn't possible without triggering a ENOENT.

In practice it translates into an infinite loop with the mkdirp package, triggered in particular by Webpack operating in production mode (because Terser uses the cache).

The fix would be to silently create the node_modules folder when a dot-file (or dot-folder) is created within node_modules.

To Reproduce

await packageJsonAndInstall({
  dependencies: {
    [`@yarnpkg/pnpify`]: `latest`,
    [`mkdirp`]: `0.5.1`,
  },
});

const res = await node(`
  (async () => {
    require('@yarnpkg/pnpify').patchFs();

    const mkdir = new Promise((resolve, reject) => {
      require('mkdirp')('node_modules/.cache', err => {
        err ? resolve('Error:  ' + err.message) : resolve(true);
      });
    });

    const timeout = new Promise(resolve => {
      setTimeout(() => resolve('Timeout!'), 1000);
    });

    return await Promise.race([mkdir, timeout]);
  })()
`);

expect(res).toEqual(true);
@arcanis arcanis added the bug Something isn't working label Oct 19, 2019
@yarnbot yarnbot added the reproducible This issue can be successfully reproduced label Oct 19, 2019
@yarnbot

This comment has been minimized.

@yarnbot

This comment has been minimized.

@yarnbot yarnbot added unreproducible This issue cannot be reproduced on master and removed reproducible This issue can be successfully reproduced labels Jun 10, 2020
@yarnbot
Copy link
Collaborator

yarnbot commented Jun 10, 2020

We couldn't reproduce your issue (all the assertions passed on master).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node-modules unreproducible This issue cannot be reproduced on master
Projects
None yet
Development

No branches or pull requests

3 participants