-
Notifications
You must be signed in to change notification settings - Fork 12
Recursive link resolving for shell value
#2388
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c330bf0
Test when shell points to a link that points to a link
ericcornelissen b873499
Correct link resolving for shell executable
ericcornelissen 8d05022
Merge branch 'main' into link-to-link-to-shell
ericcornelissen 6a01a52
Support `bsd-csh` identifier for `csh`
ericcornelissen 3f4517c
Limit link-to-link test to Linux systems
ericcornelissen d579020
Avoid infinite loop through loop detection in link resolution
ericcornelissen 6038bb9
Merge branch 'main' into link-to-link-to-shell
ericcornelissen a94641c
Update the changelog
ericcornelissen 1054c3e
Correct the comment for when `readlink` throws
ericcornelissen 7aca8f6
Properly define `bsd-csh`
ericcornelissen 9dfcf0f
Avoid error on Windows in `double-link-sh.js`
ericcornelissen aa95786
Merge branch 'main' into link-to-link-to-shell
ericcornelissen 6066f80
Handle relative (sym)links
ericcornelissen 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /** | ||
| * @overview Creates a link to a link to the "sh" binary. Used to test the link | ||
| * resolver in this library. | ||
| * @license MIT-0 | ||
| */ | ||
|
|
||
| import fs from "node:fs"; | ||
| import path from "node:path"; | ||
| import { exit } from "node:process"; | ||
|
|
||
| import which from "which"; | ||
|
|
||
| const root = path.resolve(import.meta.dirname, ".."); | ||
| const temp = path.resolve(root, ".temp", "double-link"); | ||
| if (!fs.existsSync(temp)) { | ||
| fs.mkdirSync(temp, { recursive: true }); | ||
| } | ||
|
|
||
| const shell = which.sync("sh", { nothrow: true }); | ||
| if (shell === null) { | ||
| exit(0); | ||
| } | ||
|
|
||
| const linkToShell = path.resolve(temp, "link-to-shell"); | ||
| const linkToLink = path.resolve(temp, "link-to-link"); | ||
| if (!fs.existsSync(linkToLink)) { | ||
| fs.symlinkSync(shell, linkToShell); | ||
| fs.symlinkSync(`.${path.sep}${path.basename(linkToShell)}`, linkToLink); | ||
| } | ||
|
ericcornelissen marked this conversation as resolved.
|
||
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
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.