Commit 51f4ce5
fix(pm): normalize path separators in CLONE_CACHE keys on Windows
OnceMap dedupes by *target path*, but install.rs and pipeline
workers construct the same logical target with different separators
on Windows:
install.rs: `cwd.join("node_modules/foo")` → forward slashes
(lockfile paths use `/`)
pipeline: `cwd.join(PathBuf::from("..."))` → mixed,
with `\` injected at `Path::join` boundaries
These produce distinct strings (`a/b/c` vs `a/b\c`) and OnceMap
sees them as two unrelated keys. Both clone tasks then race on the
same real directory file-by-file, surfacing as
`ERROR_SHARING_VIOLATION` (os error 32). The parent-wait via
`wait_clone_if_pending` is also defeated for the same reason.
Fix: switch the OnceMap key from `String` to `PathBuf`, and feed
it through `Path::components().collect()`. `components()` parses
both `/` and `\` as separators on Windows, and `collect::<PathBuf>()`
rebuilds with the OS-preferred separator — giving a stable key
without ad-hoc string replace and without an extra crate.
Linux/macOS unchanged (separator is already `/`). Includes a
Windows-only regression test asserting `cache_key("a/b") ==
cache_key("a\\b")`.
Surfaced by the eggjs/egg Windows e2e smoke test, which triggered
the race in `@langchain/core`'s nested node_modules.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent ac548a7 commit 51f4ce5
1 file changed
Lines changed: 39 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
| |||
24 | 32 | | |
25 | 33 | | |
26 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
27 | 46 | | |
28 | 47 | | |
29 | 48 | | |
30 | 49 | | |
31 | 50 | | |
32 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
33 | 54 | | |
34 | 55 | | |
35 | 56 | | |
| |||
42 | 63 | | |
43 | 64 | | |
44 | 65 | | |
45 | | - | |
| 66 | + | |
46 | 67 | | |
47 | 68 | | |
48 | 69 | | |
| |||
440 | 461 | | |
441 | 462 | | |
442 | 463 | | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
443 | 478 | | |
444 | 479 | | |
445 | 480 | | |
| |||
0 commit comments