bazelbuild / bazelbuild/rules_pkg
Cannot set mode for executable files via `mode` on `pkg_tar`
- Dominant language
- Starlark
- Stars
- 253
- Forks
- 221
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
Noticed after updating from 0.8.1 to 0.10.1, and narrowed down to most likely being as a result of https://github.com/bazelbuild/rules_pkg/pull/756, specifically the following line, https://github.com/bazelbuild/rules_pkg/blob/main/pkg/private/pkg_files.bzl#L411, its no longer possible to set a mode for executable files via the `mode` attribute on `pkg_tar`, as it gets forced to 0o755.
Non-executable files can still be set, as their values don't end up in the manifest (and [the manifest takes preference over flags to build_tar.py](https://github.com/bazelbuild/rules_pkg/blob/main/pkg/private/tar/build_tar.py#L309-L311)) due to the [default_mode being set to None](https://github.com/bazelbuild/rules_pkg/blob/main/pkg/private/tar/tar.bzl#L128-L130).
This makes it impossible for us to set a more restrictive mode of 0o555 on executable files.
Contributor guide
Research direction
Trace mode handling through pkg/private/pkg_files.bzl, pkg/private/tar/tar.bzl, and pkg/private/tar/build_tar.py, beginning at the referenced lines and reproducing a pkg_tar with an executable file and mode 0o555. Done means the resulting executable archive entry honors the requested restrictive mode instead of being forced to 0o755.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100