Skip to content
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 compatibility with --incompatible_sandbox_hermetic_tmp #1196

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thii
Copy link
Member

@thii thii commented Apr 15, 2024

Instead of only replacing symlinks of declared output files, now we need
to replace symlinks of everything in the declared tree artifact. Without
this, Bazel 7 would fail when it verifies the tree artifact contents,
which would contain dangling symlinks when building with
--incompatible_sandbox_hermetic_tmp.

Fixes #1129

@thii thii force-pushed the t/fix-compatibility-with-incompatible_sandbox_hermetic_tmp branch 6 times, most recently from 66f0c78 to ecb687e Compare April 17, 2024 05:12
Instead of only replacing symlinks of declared output files, now we need
to replace symlinks of everything in the declared tree artifact. Without
this, Bazel 7 would fail when it verifies the tree artifact contents,
which would contain dangling symlinks when building with
`--incompatible_sandbox_hermetic_tmp`.
@thii thii force-pushed the t/fix-compatibility-with-incompatible_sandbox_hermetic_tmp branch from ecb687e to 09c4824 Compare April 17, 2024 05:18
Copy link

@vincent-mailhol vincent-mailhol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Linux, works fine.

Nitpick: I just wonder if one of the command couldn't be simplified.

Comment on lines +256 to +260
def replace_all_symlinks(dir):
return """\
find "{dir}" -type l -exec bash -c 'for i in "$@"; do cp -a --remove-destination "$(realpath "$i")" "$i"; done' bash "{{}}" +""".format(
dir = dir,
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if the previous repalce_symlink() function could be reused here. This is what I have in mind:

Suggested change
def replace_all_symlinks(dir):
return """\
find "{dir}" -type l -exec bash -c 'for i in "$@"; do cp -a --remove-destination "$(realpath "$i")" "$i"; done' bash "{{}}" +""".format(
dir = dir,
)
def replace_all_symlinks(dir):
return """\
find "{dir}" -type l -exec ##replace_symlink## "{{}}" \\;
""".format(dir = dir)

I am not a starlark expert though. So not sure of the syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cmake: file installed from the source directory are only symlinked
2 participants