kubernetes / kubernetes/kubectl

Using cp command on Windows with absolute path malfunctions

Open
#1,406 6 comments 0 reactions 0 assignees View on GitHub
lifecycle/rotten needs-triage
Dominant language
Go
Stars
3.3k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

It seems this line causes the bug;
https://github.com/kubernetes/kubectl/blob/65639830b2b0e5f6b254d05b911b7676eb7757d2/pkg/cmd/cp/cp.go#L170

**Steps to reproduce**
Execute the command `kubectl cp C:\test.txt [your-pod]:/path/to/file/in/pod -n [namespace]`

**Expected Result**
File should be copied to the /path/to/file/in/pod

**Actual Result**
`failed to copy tar file to pod: error: one of src or dest must be a local file specification`

Contributor guide

Open the contributing guide

Research direction

Start at pkg/cmd/cp/cp.go around line 170 and reproduce the command with a Windows absolute source path: kubectl cp C:\test.txt [your-pod]:/path/to/file/in/pod -n [namespace]. Trace why the source is not recognized as local. Done means the command copies the file to the pod path without the “one of src or dest” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.