rules_pkg icon indicating copy to clipboard operation
rules_pkg copied to clipboard

Improve validation of `extension` attribute to `pkg_tar`

Open dpward opened this issue 3 years ago • 1 comments

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 in the attribute's value. [^2]: In this list, the leading dot before tar.xz is missing and should be restored.

dpward avatar Oct 13 '22 00:10 dpward

Should be done alongside #60

aiuto avatar Oct 19 '22 16:10 aiuto