Repository navigation
paths: stop the recursive mkdir walk when a parent exists but its child is still not found #40600
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
Open
robobun
wants to merge
10
commits into
main
Choose a base branch
from
farm/bb5bedd4/fix-make-path-spin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+296
−6
Open
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5fea4b8
paths: stop the recursive mkdir walk when a parent exists but its chi…
robobun 113171e
compile cache: name the errno with its E prefix on Windows
robobun 8582e30
paths: shorten the make_path_with docs
robobun ed44efa
test(install): cover BUN_INSTALL_CACHE_DIR under a dangling symlink
robobun e006fe8
paths: pin the two-steps-back shape of the make_path_with guard
robobun 1edaa7e
paths: shorten the make_path_with guard comments
robobun c682cc9
Merge remote-tracking branch 'origin/main' into farm/bb5bedd4/fix-mak…
robobun 6c72448
test(archive): cover extract with a glob below a dangling symlink
robobun 7e8da7d
test(install): assert the cache fallback, not only that the install ends
robobun 26fa2d7
test(module): run the compile cache hang test outside the concurrent …
robobun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { expect, test } from "bun:test"; | ||
| import { bunEnv, bunExe, tempDir } from "harness"; | ||
| import { symlinkSync } from "node:fs"; | ||
| import { join } from "node:path"; | ||
|
|
||
| // mkdir on a dangling symlink reports EEXIST, mkdir below it reports ENOENT. | ||
| // The recursive mkdir behind the install cache directory used to retry that | ||
| // pair forever, so `bun install` sat at 100% CPU before resolving anything. | ||
| // The folder dependency keeps the install off the network. | ||
| test("install completes when BUN_INSTALL_CACHE_DIR is under a dangling symlink", async () => { | ||
|
robobun marked this conversation as resolved.
Resolved
|
||
| using dir = tempDir("install-cache-dir-dangling", { | ||
| "proj/package.json": JSON.stringify({ | ||
| name: "x", | ||
| version: "1.0.0", | ||
| dependencies: { localdep: "file:./localdep" }, | ||
| }), | ||
| "proj/localdep/package.json": JSON.stringify({ name: "localdep", version: "1.2.3" }), | ||
| }); | ||
| symlinkSync(join(String(dir), "does-not-exist"), join(String(dir), "dangling")); | ||
|
|
||
| await using proc = Bun.spawn({ | ||
| cmd: [bunExe(), "install"], | ||
| cwd: join(String(dir), "proj"), | ||
| env: { ...bunEnv, BUN_INSTALL_CACHE_DIR: join(String(dir), "dangling", "cache") }, | ||
| stdout: "pipe", | ||
| stderr: "pipe", | ||
| }); | ||
| const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]); | ||
| expect({ stdout, stderr }).toMatchObject({ stdout: expect.stringContaining("1 package installed") }); | ||
|
robobun marked this conversation as resolved.
Resolved
|
||
| expect(exitCode).toBe(0); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.