Windows: fails to create TempDir #394
Description
I'm running https://github.com/GoogleContainerTools/container-structure-test/blob/main/bazel/test/BUILD.bazel#L3-L8 on Windows, and it fails.
Expected behavior
Should get the image name from a tar on Windows.
Actual behavior
+ exec C:/users/alex/_bazel_alex/urhld3y7/external/cst_st_windows_amd64/structure_test test --driver tar --image C:/users/alex/documents/github/container-structure-test/bazel/test/tarball.tar --config C:/users/alex/documents/github/container-structure-test/bazel/test/test.yaml
==================================
====== Test file: test.yaml ======
==================================
=== RUN: Metadata Test
--- FAIL
duration: 0s
Error: error creating driver: processing tar image reference: mkdir C:\Users\Alex\AppData\Local\Temp\C:usersalexdocumentsgithubcontainer-structure-testbazeltesttarball.tar@sha256:1e7e2b9f2239dada4f655b859ebd6faea211af04aeb0a98ef40e47f7996474761649877104: The filename, directory name, or volume label syntax is incorrect.
Traced this down to the call here which constructs that long path and fails to mkdir
:
https://github.com/GoogleContainerTools/container-diff/blob/v0.17.0/pkg/util/image_utils.go#L198
via https://github.com/GoogleContainerTools/container-diff/blob/v0.17.0/pkg/util/image_utils.go#L163
via https://github.com/GoogleContainerTools/container-structure-test/blob/v1.15.0/pkg/drivers/tar_driver.go#L40
I think this should do some more work to sanitize and shorten the name. As one proposal, we could just construct a hash of the name to make the tmpdir.
Information
- container-diff version: 0.17.0 (based on https://github.com/GoogleContainerTools/container-structure-test/blob/v1.15.0/go.mod#L6)
- Operating system: Windows!
Steps to reproduce the behavior
- Clone https://github.com/GoogleContainerTools/container-structure-test on windows
cd bazel/test
bazel test ...
and see the failure above