-
Notifications
You must be signed in to change notification settings - Fork 4.4k
[9.0.1] Force rctx.{download_and,}extract to create user-readable files (https://github.com/bazelbuild/bazel/pull/28531)
#28649
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -136,7 +136,9 @@ public Path decompress(DecompressorDescriptor descriptor) | |||||
| try (OutputStream out = filePath.getOutputStream()) { | ||||||
| tarStream.transferTo(out); | ||||||
| } | ||||||
| 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); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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
Suggested change
|
||||||
|
|
||||||
| // This can only be done on real files, not links, or it will skip the reader to | ||||||
| // the next "real" file to try to find the mod time info. | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -167,7 +167,9 @@ private static void extractZipEntry( | |||||
| throw new InterruptedException(); | ||||||
| } | ||||||
| } | ||||||
| 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); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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
Suggested change
|
||||||
| outputPath.setLastModifiedTime(entry.getTime()); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.