bazelbuild / bazelbuild/rules_pkg
Improve validation of `extension` attribute to `pkg_tar`
- Dominant language
- Starlark
- Stars
- 253
- Forks
- 221
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
If the `pkg_tar` rule is called without specifying `compressor`, then `extension` should only be allowed to take one of these values exactly (with or without the leading dot) [^1] [^2]:
https://github.com/bazelbuild/rules_pkg/blob/60dbd92d1ce3338cbb8adcb8ae8800ea3421d7b8/pkg/private/tar/tar.bzl#L35-L38
The current implementation will accept a value such as `tar.gz.bz2.xz` which implies the file has three layers of compression. It will also accept a value such as `txt.gz` which implies that it is a compressed plain text file, i.e. readable directly by `zcat`, `zless`, or similar. These should cause a failure.
[^1]: A leading dot is [silently removed](https://github.com/bazelbuild/rules_pkg/blob/60dbd92d1ce3338cbb8adcb8ae8800ea3421d7b8/pkg/private/tar/tar.bzl#L312-L313) in the attribute's value.
[^2]: In this list, the leading dot before `tar.xz` is [missing](https://github.com/bazelbuild/rules_pkg/pull/276#pullrequestreview-1138333555) and should be restored.
Contributor guide
Assessment
This issue has not been assessed yet.