[7.0.0] Don't follow symlinks when deleting test outputs#20427
Merged
keertk merged 2 commits intobazelbuild:release-7.0.0from Dec 4, 2023
Merged
[7.0.0] Don't follow symlinks when deleting test outputs#20427keertk merged 2 commits intobazelbuild:release-7.0.0from
keertk merged 2 commits intobazelbuild:release-7.0.0from
Conversation
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
meteorcloudy
approved these changes
Dec 4, 2023
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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_testcontaining a line like: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_outputsnow preserves symlinks when zipping$TEST_UNDECLARED_OUTPUTS_DIR.Closes #19948.
Change-Id: Ia4a8a9699e4e2f40498342af55babc5554a9ac93
Commit 8e639df
PiperOrigin-RevId: 587696908