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

[7.0.0] Don't follow symlinks when deleting test outputs #20427

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

bazel-io
Copy link
Member

@bazel-io bazel-io commented Dec 4, 2023

Update tools/test/test-setup.sh to preserve symlinks when performing the zip of $TEST_UNDECLARED_OUTPUTS_DIR.

This fixes a serious bug where an absolute symlink generated in the test could delete files anywhere on the filesystem.

For example, a sh_test containing a line like:

ln -s "$HOME" "$TEST_UNDECLARED_OUTPUTS_DIR/home"

would have caused the users home directory to be deleted after copying it in to the output.zip. With this change, the output.zip only contains a (possibly dangling) symlink, but more importantly the deletions are limited to the $TEST_UNDECLARED_OUTPUTS_DIR.

RELNOTES: --zip_undeclared_test_outputs now preserves symlinks when zipping $TEST_UNDECLARED_OUTPUTS_DIR.

Closes #19948.

Change-Id: Ia4a8a9699e4e2f40498342af55babc5554a9ac93
Commit 8e639df

PiperOrigin-RevId: 587696908

Update tools/test/test-setup.sh to preserve symlinks when performing the zip of `$TEST_UNDECLARED_OUTPUTS_DIR`.

This fixes a serious bug where an absolute symlink generated in the test could delete files anywhere on the filesystem.

For example, a `sh_test` containing a line like:

    ln -s "$HOME" "$TEST_UNDECLARED_OUTPUTS_DIR/home"

would have caused the users home directory to be deleted after copying it in to the output.zip. With this change, the output.zip only contains a (possibly dangling) symlink, but more importantly the deletions are limited to the `$TEST_UNDECLARED_OUTPUTS_DIR`.

RELNOTES: `--zip_undeclared_test_outputs` now preserves symlinks when zipping `$TEST_UNDECLARED_OUTPUTS_DIR`.

Closes bazelbuild#19948.

Change-Id: Ia4a8a9699e4e2f40498342af55babc5554a9ac93
PiperOrigin-RevId: 587696908
@bazel-io bazel-io requested a review from a team as a code owner December 4, 2023 14:27
@bazel-io bazel-io added team-Remote-Exec Issues and PRs for the Execution (Remote) team awaiting-review PR is awaiting review from an assigned reviewer labels Dec 4, 2023
@bazel-io bazel-io requested a review from tjgq December 4, 2023 14:27
@keertk keertk enabled auto-merge (squash) December 4, 2023 15:15
@keertk keertk merged commit b1d9fa8 into bazelbuild:release-7.0.0 Dec 4, 2023
25 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Remote-Exec Issues and PRs for the Execution (Remote) team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants