Skip to content

[9.0.1] Force rctx.{download_and,}extract to create user-readable files (https://github.com/bazelbuild/bazel/pull/28531)#28649

Merged
meteorcloudy merged 1 commit intobazelbuild:release-9.0.1from
bazel-io:cp28531-9.0.1
Feb 16, 2026
Merged

[9.0.1] Force rctx.{download_and,}extract to create user-readable files (https://github.com/bazelbuild/bazel/pull/28531)#28649
meteorcloudy merged 1 commit intobazelbuild:release-9.0.1from
bazel-io:cp28531-9.0.1

Conversation

@bazel-io
Copy link
Member

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

…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
@bazel-io bazel-io requested a review from a team as a code owner February 12, 2026 13:05
@bazel-io bazel-io added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels Feb 12, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly ensures that files extracted from various archive types (.ar, .tar, .zip) are always user-readable by adding the 0400 permission bit. The change is consistent across all relevant decompressor functions and is well-tested with new shell tests that verify the behavior for each archive type. My review includes suggestions to improve code maintainability by documenting the magic number used for the permission bit.

filePath.chmod(entry.getMode());
// Ensure that all files are at least user-readable. Some archives contain files that
// are not, but many other tools are working around this and thus mask these issues.
filePath.chmod(entry.getMode() | 0400);

Choose a reason for hiding this comment

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

high

To improve readability and maintainability, it's good practice to avoid magic numbers. Since defining a shared constant might be outside the scope of this change, consider adding a comment to clarify the meaning of 0400.

Suggested change
filePath.chmod(entry.getMode() | 0400);
filePath.chmod(entry.getMode() | 0400 /* S_IRUSR */);

filePath.chmod(entry.getMode());
// Ensure that all files are at least user-readable. Some archives contain files that
// are not, but many other tools are working around this and thus mask these issues.
filePath.chmod(entry.getMode() | 0400);

Choose a reason for hiding this comment

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

high

To improve readability and maintainability, it's good practice to avoid magic numbers. Since defining a shared constant might be outside the scope of this change, consider adding a comment to clarify the meaning of 0400.

Suggested change
filePath.chmod(entry.getMode() | 0400);
filePath.chmod(entry.getMode() | 0400 /* S_IRUSR */);

outputPath.chmod(permissions);
// Ensure that all files are at least user-readable. Some archives contain files that
// are not, but many other tools are working around this and thus mask these issues.
outputPath.chmod(permissions | 0400);

Choose a reason for hiding this comment

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

high

To improve readability and maintainability, it's good practice to avoid magic numbers. Since defining a shared constant might be outside the scope of this change, consider adding a comment to clarify the meaning of 0400.

Suggested change
outputPath.chmod(permissions | 0400);
outputPath.chmod(permissions | 0400 /* S_IRUSR */);

@iancha1992 iancha1992 added this pull request to the merge queue Feb 14, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 14, 2026
@meteorcloudy meteorcloudy added this pull request to the merge queue Feb 16, 2026
Merged via the queue into bazelbuild:release-9.0.1 with commit 155c1fc Feb 16, 2026
46 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Feb 16, 2026
@iancha1992 iancha1992 mentioned this pull request Feb 18, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants