-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
fix(compile): do not error embedding same symlink via multiple methods #27015
Merged
+32
−2
Merged
Changes from all commits
Commits
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 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 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,27 @@ | ||
{ | ||
"tempDir": true, | ||
"steps": [{ | ||
"args": "run -A setup.js", | ||
"output": "[WILDCARD]" | ||
}, { | ||
"if": "unix", | ||
"args": "compile --allow-read=data --include . --output main link.js", | ||
"output": "[WILDCARD]" | ||
}, { | ||
"if": "unix", | ||
"commandName": "./main", | ||
"args": [], | ||
"output": "1\n", | ||
"exitCode": 0 | ||
}, { | ||
"if": "windows", | ||
"args": "compile --allow-read=data --include . --output main.exe link.js", | ||
"output": "[WILDCARD]" | ||
}, { | ||
"if": "windows", | ||
"commandName": "./main.exe", | ||
"args": [], | ||
"output": "1\n", | ||
"exitCode": 0 | ||
}] | ||
} |
This file contains 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,3 @@ | ||
Deno.mkdirSync("data"); | ||
Deno.writeTextFileSync("index.js", "console.log(1);"); | ||
Deno.symlinkSync("index.js", "link.js"); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of a
--include
indeno compile
, if the same sym link is inserted twice (which can happen if a parent and child directory are both included), which path will it be found under? I guess with this code change, it will only be found under the first path, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you insert a parent and then insert the child, the child would overwrite the child within the parent (we could be smarter about knowing if a parent was previously inserted to skip the work, but I think it's not worth it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For complex virtual file systems, you may actually want both entries. I hit this problem when trying to add a
node_modules
directory to adeno compile
(probably not a good idea anyways). But I think that is a much bigger problem than what needs to be solved here. Thanks for the fix.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean be including both entries. Wouldn't there only be one symlink?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given a file structure like this:
and
deno compile --include folder/ --include folder/sub_folder/ print_asset.ts
Would I expect:
I could read the
my_static_assets
under:import.meta.dirname + "/folder/sub_folder/assets/my_static_asset.txt"
import.meta.dirname + "/folder/assets/my_static_asset.txt"
The same symlink is found twice when that directory is recursed. I'm not sure if that works anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled down this PR and gave it a spin.
--include folder/
is provided. That is, given the structure above and:Then the following fails to resolve:
But this works fine if:
is used. However, this wasn't working before this change-set, so I would consider that separate issue.
That's a long way of saying 👍 by me, and I can file an another issue for the more complex layout if you'd like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, you need to also include the
assets
directory, otherwise only the symlinks are included in thefolder
directory.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1. Yep, that fixes things. I'm not sure if it's obvious that the targets of the sym links need to be included, but that's probably a good thing in the end.
I wrote a small tool that prints the contents of the
import.meta.dirname
and with this change-set applied things are much better. 👍 from me, but maybe Bartek can give this a final review. Thanks again for the fix.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened these issues for the future:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found another unrelated issue while testing this (this fails before this change-set is applied, so it shouldn't hold up this work). I filed an issue: #27024