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

Windows: fails to create TempDir #394

Closed
@alexeagle

Description

@alexeagle

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions