Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Windows: fails to create TempDir #394

Closed
alexeagle opened this issue Jul 21, 2023 · 0 comments · Fixed by #395
Closed

Windows: fails to create TempDir #394

alexeagle opened this issue Jul 21, 2023 · 0 comments · Fixed by #395

Comments

@alexeagle
Copy link
Contributor

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

Steps to reproduce the behavior

  1. Clone https://github.com/GoogleContainerTools/container-structure-test on windows
  2. cd bazel/test
  3. bazel test ... and see the failure above
alexeagle added a commit to aspect-forks/container-structure-test that referenced this issue Jul 21, 2023
Also point to a fork of container-diff repo to workaround GoogleContainerTools/container-diff#394
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant