Force rctx.{download_and,}extract to create user-readable files#28531
Force rctx.{download_and,}extract to create user-readable files#28531fmeum wants to merge 2 commits intobazelbuild:masterfrom
rctx.{download_and,}extract to create user-readable files#28531Conversation
|
@bazel-io fork 9.1.0 |
|
@bazel-io fork 8.6.0 |
There was a problem hiding this comment.
Code Review
This pull request correctly ensures that files extracted from archives are at least user-readable by adding the 0400 permission bit. The changes are consistently applied across ar, tar, and zip decompressors. The accompanying tests are thorough and validate the new behavior for each archive type. I've included one suggestion to refactor the new tests to reduce code duplication and improve maintainability.
There was a problem hiding this comment.
Pull request overview
This PR ensures that files extracted from archives (tar, zip, and ar) are always user-readable, even if the archive contains files with no read permissions. This addresses a real-world issue where some archives contain non-readable files, but other tools work around this and mask the problem.
Changes:
- Modified three decompressor implementations to force user-readable permissions (0400 bit) on extracted files
- Added integration tests for tar.gz, zip, and ar archives with non-readable files
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/main/java/com/google/devtools/build/lib/bazel/repository/decompressor/ZipDecompressor.java | Added bitwise OR with 0400 to ensure extracted files have user-read permission |
| src/main/java/com/google/devtools/build/lib/bazel/repository/decompressor/CompressedTarFunction.java | Added bitwise OR with 0400 to ensure extracted tar files have user-read permission |
| src/main/java/com/google/devtools/build/lib/bazel/repository/decompressor/ArFunction.java | Added bitwise OR with 0400 to ensure extracted ar files have user-read permission |
| src/test/shell/bazel/starlark_repository_test.sh | Added three test functions that verify files with 0o000 permissions can be read after extraction |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
86e526d to
6715aa8
Compare
Archives in the wild do sometimes contain non-readable files, but other tools work around this and thus mask their brokenness.
6715aa8 to
5a1b258
Compare
…zelbuild#28531) Archives in the wild do sometimes contain non-readable files, but other tools work around this and thus mask their brokenness. Context: https://bazelbuild.slack.com/archives/CDCMRLS23/p1770213515354229 Closes bazelbuild#28531. PiperOrigin-RevId: 865960367 Change-Id: I7273eb983d63d6960d184764cec5040bba77b2c2
…zelbuild#28531) Archives in the wild do sometimes contain non-readable files, but other tools work around this and thus mask their brokenness. Context: https://bazelbuild.slack.com/archives/CDCMRLS23/p1770213515354229 Closes bazelbuild#28531. PiperOrigin-RevId: 865960367 Change-Id: I7273eb983d63d6960d184764cec5040bba77b2c2
…iles (#28531) (#28547) Archives in the wild do sometimes contain non-readable files, but other tools work around this and thus mask their brokenness. Context: https://bazelbuild.slack.com/archives/CDCMRLS23/p1770213515354229 Closes #28531. PiperOrigin-RevId: 865960367 Change-Id: I7273eb983d63d6960d184764cec5040bba77b2c2 Commit 0bb7836 Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
…iles (ht… (#28551) …tps://github.com//pull/28531) Archives in the wild do sometimes contain non-readable files, but other tools work around this and thus mask their brokenness. Context: https://bazelbuild.slack.com/archives/CDCMRLS23/p1770213515354229 Closes #28531. PiperOrigin-RevId: 865960367 Change-Id: I7273eb983d63d6960d184764cec5040bba77b2c2 Commit 0bb7836 Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
|
@bazel-io fork 9.0.1 |
…zelbuild#28531) Archives in the wild do sometimes contain non-readable files, but other tools work around this and thus mask their brokenness. Context: https://bazelbuild.slack.com/archives/CDCMRLS23/p1770213515354229 Closes bazelbuild#28531. PiperOrigin-RevId: 865960367 Change-Id: I7273eb983d63d6960d184764cec5040bba77b2c2
…iles (#28531) (#28649) Archives in the wild do sometimes contain non-readable files, but other tools work around this and thus mask their brokenness. Context: https://bazelbuild.slack.com/archives/CDCMRLS23/p1770213515354229 Closes #28531. PiperOrigin-RevId: 865960367 Change-Id: I7273eb983d63d6960d184764cec5040bba77b2c2 Commit 0bb7836 Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
Archives in the wild do sometimes contain non-readable files, but other tools work around this and thus mask their brokenness.
Context: https://bazelbuild.slack.com/archives/CDCMRLS23/p1770213515354229
In the wild example: https://pypi.org/project/ag-ui-adk/#ag_ui_adk-0.4.2-py3-none-any.whl