bazel-contrib / bazel-lib

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

windows tar toolchain gzip errors #968

Open jbedard opened 1 month ago

jbedard commented 1 month 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 month 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 month ago

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

thesayyn commented 3 weeks ago

Related https://github.com/bazel-contrib/bazel-lib/issues/848

thesayyn commented 2 days ago

@jbedard https://github.com/bazelbuild/bazel-central-registry/pull/3225 is going to fix this but there https://github.com/bazel-contrib/bazel-lib/issues/952 that needs to be fixed before we can roll this