bazel-contrib / bazel-lib

Common useful functions for writing BUILD files and Starlark macros/rules
Apache License 2.0
137 stars 89 forks source link

windows tar toolchain gzip errors #968

Open jbedard opened 1 week ago

jbedard commented 1 week ago

See https://github.com/aspect-build/rules_js/actions/runs/11391002935/job/31694034057?pr=1989#step:7:456

(18:41:49) ERROR: D:/a/rules_js/rules_js/e2e/bzlmod/BUILD.bazel:14:22: Extracting npm package package-json-from-dist@1.0.1 failed: (Exit 1): tar.exe failed: error executing command (from target //:.aspect_rules_js/node_modules/package-json-from-dist@1.0.1/pkg) external\aspect_bazel_lib~2.9.0~toolchains~bsd_tar_windows_amd64\tar.exe --extract --no-same-owner --no-same-permissions --strip-components 1 --file ... (remaining 3 arguments skipped)
tar.exe: Error opening archive: Can't initialize filter; unable to run program "gzip -d"
thesayyn commented 1 week ago

Turns out we don't link any of the [de]compression filters for windows builds, they were simply shelling out to system binaries, which did not exist in this case.

This is where we set these for mac and linux

https://github.com/bazelbuild/bazel-central-registry/blob/ef34e6bfad5a6ab54080ddcc83a4d65849855e3a/modules/libarchive/3.7.5/patches/build_with_bazel.patch#L1510-L1522

but not for windows

https://github.com/bazelbuild/bazel-central-registry/blob/ef34e6bfad5a6ab54080ddcc83a4d65849855e3a/modules/libarchive/3.7.5/patches/build_with_bazel.patch#L1548

thesayyn commented 1 week ago

Needs to be fixed in libarchive in BCR before it can be fixed here.