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

It was unable to overwrite symlink concurrently #57

Closed
KSXGitHub opened this issue Oct 28, 2024 · 0 comments · Fixed by #59
Closed

It was unable to overwrite symlink concurrently #57

KSXGitHub opened this issue Oct 28, 2024 · 0 comments · Fixed by #59
Labels

Comments

@KSXGitHub
Copy link
Contributor

The CI log:

2024-10-28T18:05:23.8887744Z pnpm: ENOENT: no such file or directory, unlink 'D:\a\pnpm\pnpm_tmp\126_7008\9\project\cache\dlx\c5a0372be11a7307322ba5932d161ca4d94858a3dd669b9665ff3e38f87222f2\pkg'
2024-10-28T18:05:23.8888769Z     at async Object.unlink (node:internal/fs/promises:1060:10)
2024-10-28T18:05:23.8889372Z     at async forceSymlink (D:\a\pnpm\pnpm\pnpm\dist\pnpm.cjs:105082:7)
2024-10-28T18:05:23.8890046Z     at async Object.handler [as dlx] (D:\a\pnpm\pnpm\pnpm\dist\pnpm.cjs:224776:11)
2024-10-28T18:05:23.8890642Z     at async D:\a\pnpm\pnpm\pnpm\dist\pnpm.cjs:234691:21
2024-10-28T18:05:23.8891177Z     at async main (D:\a\pnpm\pnpm\pnpm\dist\pnpm.cjs:234650:34)
2024-10-28T18:05:23.8891999Z     at async runPnpm (D:\a\pnpm\pnpm\pnpm\dist\pnpm.cjs:234922:5)
2024-10-28T18:05:23.8892520Z     at async D:\a\pnpm\pnpm\pnpm\dist\pnpm.cjs:234914:7

This correlates to this line of dist/pnpm.cjs:

      if (target === linkString) {
        return { reused: true };
      }
      if ((opts === null || opts === void 0 ? void 0 : opts.overwrite) === false) {
        throw initialErr;
      }
      await fs_1.promises.unlink(path2); // <-- THIS LINE (pnpm.cjs:105082:7)
      return await forceSymlink(target, path2, opts);

Which was invoked by this:

        try {
          await (0, symlink_dir_1.default)(cachedDir, cacheLink, { overwrite: true });
        } catch (error) {
          if (!util_1.default.types.isNativeError(error) || !("code" in error) || error.code !== "EBUSY") {
            throw error;
          }
        }

Which should correlate with this line:

https://github.com/pnpm/pnpm/blob/bce37851f9b841424f960c37f300b5a7358f0bed/exec/plugin-commands-script-runners/src/dlx.ts#L95

As we can see, the pnpm code is specifying { overwrite: true } correctly, but it was symlink-dir that is unable to handle it correctly when it was called concurrently.

Note

The above log came from a modified pnpm, so it doesn't correlate with pnpm from the main branch.

@KSXGitHub KSXGitHub added the bug label Oct 28, 2024
KSXGitHub added a commit that referenced this issue Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant