-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
feat: add Support for Symlinks in tar Rule's Runfiles Handling #1036
Conversation
8a5d7fc
to
e87fad1
Compare
Looking great already. |
8421e11
to
95f66d4
Compare
95f66d4
to
0e4d8de
Compare
700a57e
to
6340e9f
Compare
You have some buildifier errors. |
Should be all good now |
Hi @thesayyn I am noticing two potential issues
I have thought about a few things
|
I like the numbers, yes, i was also curious of performance implications for something like this. 5mins for 150k is unpleasant.
Oh, yes, there must be more to the logic that what we currently have here; See: https://github.com/aspect-build/rules_js/blob/main/js/private/image/index.ts#L84 it's been in use for a while and covers some edge cases.
That is possible, yes, but i don't it will report correctly for things declared as file but is symlink, eg treeartifact containing a symlink. there is no way to know about symlinks inside treeartifacts.
I have little to no faith that it would be faster than what we right now, since My current thinking is that, while writing a go tool for this is convenient, its probably overkill, and will fall short if people need to customize it, i'd like to use that effort to make a proper awk setup. https://github.com/thesayyn/prebuilt_toolchains has an AWK recipe for Bazel, i am planning to make a toolchain for it. AWK has this concept of extensions https://www.gnu.org/software/gawk/manual/html_node/gawkextlib.html which we can use to introduce a new readlink function to get near native performance within awk, so instead of References: https://sourceforge.net/projects/gawkextlib/ |
All that said, i don't mind landing this as is, since its behind a flag, (which we should mark as experimental BTW), and get some feedback and interest before investing more into this. |
Fair enough, |
You need to update the docs because of the new flag.
|
Is |
No need for the experimental prefix, we can just put a |
20ac274
to
672f785
Compare
hi @thesayyn |
4fe7796
to
f8247c1
Compare
@thesayyn, I added From
Will be possible to replace |
@thesayyn made the suggested change |
Hmm, the test is failing due to mtime, https://github.com/bazel-contrib/bazel-lib/actions/runs/13054891062/job/36493038666?pr=1036#step:6:252 Can you set it to a static value in your tests? |
Just fixed it |
b6d7827
to
e80bdf0
Compare
This Pull Request (PR) enhances the
tar
rule to better handle symlinks within runfiles, improving compatibility with various language ecosystemsCurrently, symlinks within runfiles are not correctly reflected in the
mtree_spec
generated by Bazel, causing issues in packaging, especially for symlink-sensitive applications like Node.js withpnpm
.Changes
Symlink Detection and Resolution
readlink
.mtree_spec
accurately represents symlink structures.MTree Mutation
awk
scripting to adjust themtree_spec
after it is generated.mtree_spec
.readlink -f
.type=link
and the correctlink=
path when applicable.closes #603