bazelbuild / bazelbuild/rules_pkg
stripping leading './' creates broken archives when used with deps.
- Dominant language
- Starlark
- Stars
- 253
- Forks
- 221
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
pkg_tar creates broken archives when any of the `deps` contain entries with leading `./` in their path.
Imagine a tar file that is downloaded via http_archive with leading `./` path entries
```
./var/
./var/backups/
./var/cache/
./var/lib/
./var/lib/dpkg/
./var/local/
./var/lock/
./var/log/
./var/run/
./var/spool/
./var/tmp/
./etc/os-release
```
A BUILD file that looks like this;
```starlark
pkg_tar(
srcs = [
"./var/lib/dpkg/somefile"
],
deps = ["@label/to/downloaded_archive"]
)
```
The resulting archive that pkg_tar creates, in this case, looks like the below;
```
./var/cache/
./var/lib/
./var/lib/dpkg/
var/
var/lib/
var/lib/dpkg/
var/lib/dpkg/status.d/
var/lib/dpkg/status.d/base-files
var/lib/dpkg/status.d/base-files.md5sums
```
This semantically corrupt archive as there are two entries for `var/lib/dpkg/`. `var/lib/dpkg/` and `./var/lib/dpkg/` is the same from the extractor tools standpoint.
Ideally, I'd expect pkg_tar to have no opinion about what leading path the entries have but I guess that's not an option anymore.
If that's the case pkg_tar should be fixing the deps as well to produce semantically correct archives.
Contributor guide
Assessment
This issue has not been assessed yet.