Skip to content

Stop handing tar a path it may read as a remote host - #6

Merged
btriapitsyn merged 1 commit into
mainfrom
fix/snapshot-tar-windows-path
Aug 6, 2026
Merged

Stop handing tar a path it may read as a remote host#6
btriapitsyn merged 1 commit into
mainfrom
fix/snapshot-tar-windows-path

Conversation

@btriapitsyn

Copy link
Copy Markdown
Collaborator

Problem

Creating a workspace on Windows failed partway through and rolled back after ~25 seconds — long enough that pods appeared, started, and were then killed, which presents as a timeout rather than a failure.

The source snapshot runs:

tar -cf C:\...\source.tar --exclude ./.git .

To GNU tar, C:\... is host:path — a request to connect to a host named C:

tar: Cannot connect to C: resolve failed

Which tar answers is decided by PATH order. Windows ships bsdtar in System32, which takes the path literally and works. Git for Windows ships GNU tar, which does not — and Git for Windows usually comes first. The same command succeeded or failed depending on what else was installed.

Every provider snapshots through this path, so this was never specific to Kubernetes.

Change

--force-local would fix GNU tar and break bsdtar, which rejects the option. Instead the archive is written through stdout, so no path is passed to tar at all:

tar -cf - --exclude ./.git .        # stdout piped to the destination

Nothing detects a flavour, and nothing has to be revisited for the next tool that takes a path. runToFile carries the same timeout, kill and error semantics as run, and resolves only after the file is closed so a caller may read it immediately.

Validation

Windows, against a live kind cluster, with GNU tar first on PATH:

Before After
Workspace creation fails after 25s completes in 78s

Two long-standing Windows failures in the snapshot suite — hard-linked files, and mutation-during-archive detection — were this same bug, and now pass. The remaining Windows failures (symlinks, POSIX modes) are unrelated and unchanged.

Creating a workspace on Windows failed partway through and rolled back, taking
roughly twenty-five seconds to do it — long enough that the pods appeared,
started, and were then killed, which reads as a timeout rather than a failure.
The cause was the source snapshot: `tar -cf C:\...\source.tar` is a request to
GNU tar to connect to a host named "C", and it answers "Cannot connect to C:
resolve failed".

Which tar answers is decided by PATH order. Windows ships bsdtar in System32,
which takes the path literally and works; Git for Windows ships GNU tar, which
does not, and Git for Windows usually comes first. The same command therefore
succeeded or failed depending on what else was installed — and every provider
snapshots the same way, so this was never specific to Kubernetes.

`--force-local` would fix GNU tar and break bsdtar, which rejects the option,
so the archive is now written through stdout and no path is passed to tar at
all. Nothing has to detect a flavour, and nothing has to be revisited for the
next tool that takes a path.

Verified on Windows against a live cluster: creation with GNU tar first on PATH
failed after 25 seconds before this change and completes in 78 seconds after
it. Two long-standing Windows test failures in the snapshot suite were the same
bug and now pass.
@btriapitsyn
btriapitsyn merged commit 236cf68 into main Aug 6, 2026
7 checks passed
@btriapitsyn
btriapitsyn deleted the fix/snapshot-tar-windows-path branch August 6, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants