Bug 1919032

Summary: oc image extract - will not extract files from image rootdir - "error: unexpected directory from mapping tests.test"
Product: OpenShift Container Platform Reporter: Motty Sisam <msisam>
Component: ocAssignee: Robin Cernin <rcernin>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.7CC: aos-bugs, jokerman, maszulik, mfojtik, rcernin
Target Milestone: ---   
Target Release: 4.8.0   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
This patch fixes the issue where oc image extract would not extract files from the image root directory.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-27 22:36:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Motty Sisam 2021-01-22 00:00:29 UTC
Description of problem:
When executing 
oc image extract on an image provided with --file="/file.ext" or --file="file"
or --path=file.ext:./file.ext
it will not extract it. we would get error: unexpected directory from mapping tests.test

but when given a directory within such as --file="/dir/file.ext" 
then it would work. 

Version-Release number of selected component (if applicable):
Client Version: 4.7.0-fc.3

How reproducible:

1. For seeing that's it is Not working:

oc image extract image_name --path 
/somefile.txt:/tmp/

2. for it to work
oc image extract image_name --path 
/tmp/somefile.txt:/tmp/


Actual results:
File is not copied from /
getting error: 
error: unexpected directory from mapping file.txt

Expected results:
For file to be copied from / 

Additional info:

Comment 3 Maciej Szulik 2021-02-08 12:23:11 UTC
Pushing this over to 4.8 since 4.7 is closed.

Comment 6 zhou ying 2021-02-10 01:29:50 UTC
Confirmed with latest 4.8 oc, the issue has fixed:

[root@preserver-workloadrhel-1 ext]# /root/oc version -o yaml 
clientVersion:
  buildDate: "2021-02-09T20:21:40Z"
  compiler: gc
  gitCommit: 1d60e58c7db414dd584ce214fadbe57f24022496
  gitTreeState: clean
  gitVersion: 4.8.0-202102091857.p0-1d60e58
  goVersion: go1.15.5
  major: ""
  minor: ""
  platform: linux/amd64
releaseClientVersion: 4.8.0-0.nightly-2021-02-09-221546


[root@preserver-workloadrhel-1 ext]# /root/oc image extract localhost:5000/alpine:new --file /hello --insecure
[root@preserver-workloadrhel-1 ext]# ls 
hello

Comment 9 errata-xmlrpc 2021-07-27 22:36:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:2438