Merge pull request #73982 from tanshanshan/fixcp

fix cp time stamp is in the future error
This commit is contained in:
Kubernetes Prow Robot 2019-07-02 22:48:29 -07:00 committed by GitHub
commit 75a39b7007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -249,9 +249,9 @@ func (o *CopyOptions) copyToPod(src, dest fileSpec, options *exec.ExecOptions) e
// TODO: Improve error messages by first testing if 'tar' is present in the container? // TODO: Improve error messages by first testing if 'tar' is present in the container?
if o.NoPreserve { if o.NoPreserve {
cmdArr = []string{"tar", "--no-same-permissions", "--no-same-owner", "-xf", "-"} cmdArr = []string{"tar", "--no-same-permissions", "--no-same-owner", "-xmf", "-"}
} else { } else {
cmdArr = []string{"tar", "-xf", "-"} cmdArr = []string{"tar", "-xmf", "-"}
} }
destDir := path.Dir(dest.File) destDir := path.Dir(dest.File)
if len(destDir) > 0 { if len(destDir) > 0 {

View File

@ -681,11 +681,11 @@ func TestCopyToPodNoPreserve(t *testing.T) {
nopreserve bool nopreserve bool
}{ }{
"copy to pod no preserve user and permissions": { "copy to pod no preserve user and permissions": {
expectedCmd: []string{"tar", "--no-same-permissions", "--no-same-owner", "-xf", "-", "-C", "."}, expectedCmd: []string{"tar", "--no-same-permissions", "--no-same-owner", "-xmf", "-", "-C", "."},
nopreserve: true, nopreserve: true,
}, },
"copy to pod preserve user and permissions": { "copy to pod preserve user and permissions": {
expectedCmd: []string{"tar", "-xf", "-", "-C", "."}, expectedCmd: []string{"tar", "-xmf", "-", "-C", "."},
nopreserve: false, nopreserve: false,
}, },
} }