bazelbuild / bazelbuild/rules_pkg
`pkg_rpm` cannot set different permissions to the executable in `pkg_files` and to its runfiles
- Dominant language
- Starlark
- Stars
- 253
- Forks
- 221
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
### The problem
`pkg_tar` automatically detects the executable in `pkg_files`:
https://github.com/bazelbuild/rules_pkg/blob/c53ff51070c96b368188f057a6683d97c31b77f7/pkg/private/pkg_files.bzl#L395
And sets its execution bit:
https://github.com/bazelbuild/rules_pkg/blob/c53ff51070c96b368188f057a6683d97c31b77f7/pkg/private/pkg_files.bzl#L411
`pkg_rpm` does not seem to do anything similar, so executables end up with the same file mode as the rest of the files in the provider, which is usually a mode without the execution bit.
### Workaround
A workaround is to set the execution bit for the `pkg_files` target, which will set it for the executable and all its runfiles, but this is not ideal. It would be better if the default was to preserve the file mode of the source file, I think that would work reasonably well.
### Future work
This highlights a general issue with the `include_runfiles` attribute in `pkg_files`: because the executable and all its runfiles are grouped inside a single `PackageFilesInfo` provider, there is no granularity to have different attributes or prefixes for different files.
There is also the issue of executables being included twice, as the main target, and as one of the runfiles, which makes a warning show up (file mapped to two different destinations). This should probably have its own issue though.
Contributor guide
Assessment
This issue has not been assessed yet.