openshift / openshift/origin

Rsync via tar creates nested directories on Windows because slashes are not inverted to Windows style

Open
#14,065 3 comments 0 reactions 1 assignee View on GitHub

@csrwng is already working on this.

Since May 5, 2017.

area/usability component/cli kind/bug lifecycle/frozen lifecycle/rotten priority/P2
Dominant language
Go
Stars
8.7k
Forks
4.8k
Avg merge
4d 10h
Merged PRs (30d)
53

Description

According to the oc rsync documentation:

If rsync is not found locally or in the remote container, then a tar archive will be created locally and sent to the container where tar will be used to extract the files. If tar is not available in the remote container, then the copy will fail.

So in order to replicate the issue we first need to remove rsync from the PATH (or you can simply rename rsync binary). So now tar strategy will be used for rsync.

Let's run: oc rsync .\Desktop\mydir/ <pod-name>:/tmp/mydir/ - pay attention to forward slash / in Windows path. After this one more mydir directory is created in the pod in /tmp/mydir/. So everything local is now synced with /tmp/mydir/mydir in the pod. And if you then sync it down to local, you then have this nested structure locally too. Repeating this process leads to the issues which have now in jbosstools plugin for openshift: JBIDE-24322 and JBDS-4070.

Of course, the error is also on our side, because we set the path the wrong way. However this situation works fine when rsync strategy is used for oc rsync, because it is processed well: https://github.com/openshift/origin/blob/85eb37b34f0657631592356d020cef5a58470f8e/pkg/cmd/cli/cmd/rsync/pathspec.go#L78. But this function isn't called for tar rsync strategy, which we think should be added

Version

doesn't matter.
but for example:
oc v1.4.1+3f9807a
kubernetes v1.4.0+776c994

Steps To Reproduce
  1. remove rsync from the PATH (or you can simply rename rsync binary). So now tar strategy will be used for rsync
  2. run: oc rsync .\Desktop\mydir/ <pod-name>:/tmp/mydir/ - pay attention to forward slash / in Windows path
Current Result

one more mydir directory is created in the pod in /tmp/mydir/. So everything local is now synced with /tmp/mydir/mydir in the pod

Expected Result

no nested folders are created. All slashes in paths are substituted correctly on Windows.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.