Bug 1469411 - Can`t copy local directory & files to correct directory & files in a remote pod through "oc cp".
Can`t copy local directory & files to correct directory & files in a remote p...
Product: OpenShift Container Platform
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: 3.9.0
Assigned To: Juan Vallejo
Xingxing Xia
: Rebase
Depends On:
  Show dependency treegraph
Reported: 2017-07-11 04:47 EDT by xipang
Modified: 2018-01-04 22:22 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description xipang 2017-07-11 04:47:06 EDT
Description of problem:
Can`t copy local directory & files to correct directory & files in a remote pod through "oc cp".

Version-Release number of selected component (if applicable):
oc v3.6.140
kubernetes v1.6.1+5115d708d7
features: Basic-Auth GSSAPI Kerberos SPNEGO

How reproducible:

Steps to Reproduce:
1.oc login and create two projects 
$oc new-project newproj02
$oc new-project newproj01

2.create application(e.g.ruby) in newproj01 and prepare files & dirs
2.1 Prepare local dirs /tmp/foo_dir 
2.2 Prepare local files /tmp/foo /tmp/bar /tmp/foo_2 /tmp/foo_dir/foo.local
$cat >>/tmp/foo<<-EOF
> Copy from local.
$cat >>/tmp/foo_2<<-EOF
> Copy from local.
2.3 Prepare pod files /tmp/foo_pod /tmp/bar /tmp/bar_2 and dirs /tmp/bar_dir in a remote pod

3.Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the current namespace
$oc cp /tmp/foo_dir ruby-1-4fcv8:/tmp/bar_dir

4.Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container
$oc cp /tmp/foo ruby-1-4fcv8:/tmp/bar -c ruby

5.Copy /tmp/foo_2 local file to /tmp/bar_2 in a remote pod in namespace <some-namespace>
$oc project newproj02
$oc cp /tmp/foo_2 newproj01/ruby-1-4fcv8:/tmp/bar_2

6.Copy /tmp/foo_pod from a remote pod to /tmp/bar locally
$oc cp newproj01/ruby-1-4fcv8:/tmp/foo_pod /tmp/bar

Actual results:
3.foo.local file not in /tmp/bar_dir directory in pod,but foo_dir directory was copied to /tmp directory 
$oc rsh ruby-1-4fcv8
$cat /tmp/bar_dir/foo.local
cat: /tmp/bar_dir/foo.local: No such file or directory
$ls /tmp
... foo_dir ...

4. foo local file content wasn't copied to bar file in pod,but foo local file was copied to /tmp directory
$oc rsh ruby-1-4fcv8
$ls /tmp
... foo ...

5.Same as step 4

6. Can copy successfully, but it shows msg " tar: Removing leading `/' from member names"

Expected results:
3.$oc rsh ruby-1-4fcv8
$ls /tmp/bar_dir

4.$cat /tmp/bar
Copy from local.

5. Same as step 4

6. The msg is better to be removed

Additional info:
Comment 1 Juan Vallejo 2017-08-23 11:13:39 EDT
Origin PR: https://github.com/openshift/origin/pull/15929
Comment 2 Juan Vallejo 2017-08-23 11:48:00 EDT
> 6. The msg is better to be removed

"Removing leading `/' from member names" is output as part of the `tar` pkg. I think it makes sense to leave this warning
Comment 3 Juan Vallejo 2017-08-23 15:06:33 EDT
Upstream PR: https://github.com/kubernetes/kubernetes/pull/51215
Comment 4 Juan Vallejo 2017-08-25 16:04:25 EDT
Marking as "UpcomingRelease" this is entirely an upstream patch [1]; changes will be brought in with the next rebase. Closing downstream pull [2].

1. https://github.com/kubernetes/kubernetes/pull/51215
2. https://github.com/openshift/origin/pull/15929
Comment 5 Juan Vallejo 2017-10-12 15:39:08 EDT
Upstream PR [1] has merged. Bug will be fixed next rebase. Marking as UpcomingRelease
Comment 6 Fabiano Franz 2017-12-07 13:21:49 EST
Fixed in 3.8.
Comment 8 Xingxing Xia 2018-01-04 22:22:38 EST
Testing with latest v3.8 oc v3.8.26, the bug still exists. Testing with latest v3.9 oc v3.9.0-0.16.0, the bug is fixed. Results are followed
Saw "Flags: aos-3.9.0+" was added and the errata advisory is for 3.9, thus it is inferred "Target Release" 3.8.0 is outdated and will being updated

$ oc version
oc v3.9.0-0.16.0
kubernetes v1.9.0-beta1
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://api.free-int.openshift.com:443
openshift v3.8.18
kubernetes v1.8.1+0d5291c

$ oc cp /tmp/foo_dir $POD:/tmp/bar_dir # Will get same result when with or without '/' is given after '/tmp/bar_dir'
$ oc rsh $POD
sh-4.2$ ls /tmp/bar_dir

$ oc cp /tmp/foo $POD:/tmp/bar -c ruby
$ oc rsh $POD
sh-4.2$ ls /tmp/bar

> The msg is better to be removed
As to this, the msg still exists. IMO it is acceptable

Note You need to log in before you can comment on or make changes to this bug.