bazelbuild / bazelbuild/rules_pkg

stripping leading './' creates broken archives when used with deps.

Open
#652 3 comments 0 reactions 0 assignees View on GitHub
bug P3
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.