mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-26 11:02:01 -04:00
## Summary `linkBin()` unconditionally calls `cmdShim()` / `symlinkDir()` even when the target bin already points at the correct path. This causes redundant I/O on repeated installs and `EACCES` failures when the bin directory lives on a read-only filesystem (Docker layer caching, CI prewarm, NFS mounts). This PR adds a check at the top of `linkBin()` that verifies the existing bin before skipping: - **Symlinks**: `readlink` target is compared against `cmd.path` - **Cmd-shim files**: checked via `isShimPointingAt()` from `@zkochan/cmd-shim` v9, which embeds a `# cmd-shim-target=<path>` marker in every generated sh shim - Files larger than 4KB (binaries) are never skipped — they are not cmd-shims Stale or incorrect bins (wrong target, missing marker, different provider) are always rewritten. Follows up on feedback from #11020. ## Changes - `bins/linker/src/index.ts` — add target verification check in `linkBin()` - `bins/linker/test/index.ts` — tests for skip and rewrite behavior - `pnpm-workspace.yaml` — upgrade `@zkochan/cmd-shim` to v9 --------- Co-authored-by: Zoltan Kochan <z@kochan.io>