Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman cp, with volumes + tarfile + exact name match, is a NOP #3550

Closed
edsantiago opened this issue Jul 10, 2019 · 37 comments
Closed

podman cp, with volumes + tarfile + exact name match, is a NOP #3550

edsantiago opened this issue Jul 10, 2019 · 37 comments
Assignees
Labels
jetsam "...cargo that is cast overboard to lighten the load in time of distress" kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@edsantiago
Copy link
Member

Looks like an obscrure corner case of #3059

# podman volume create v
v
# vdir=$(podman volume inspect -f '{{.MountPoint}}' v)
# ls -la $vdir
total 8
drwxr-xr-x. 2 root root 4096 Jul 10 17:55 .
drwx------. 3 root root 4096 Jul 10 17:55 ..

Now create a tarball:

# mkdir mysubdir
# echo this is a file >mysubdir/myfile
# tar cf mysubdir.tar mysubdir

Then create a container, mounting the volume using the same name as the subdirectory in the tarball. podman cp of the tarball into the container will silently fail:

# podman create --name foo -v v:/mysubdir alpine
70f1ad4ac78d5933fd2e0ebefdeb46435c38da382c06b77de00073e63f18984b
# podman cp - foo:/ < mysubdir.tar
# ls -la $vdir/
total 8
drwxr-xr-x. 2 root root 4096 Jul 10 18:02 .
drwx------. 3 root root 4096 Jul 10 17:55 ..

cp into the volume subdirectory works:

# podman cp - foo:/mysubdir < mysubdir.tar
# ls -l $vdir/
total 4
drwxr-xr-x. 2 root root 4096 Jul 10 17:57 mysubdir
# ls -l $vdir/mysubdir/
total 4
-rw-r--r--. 1 root root   15 Jul 10 17:57 myfile

podman-1.4.4-3.fc30

@mheon mheon added the kind/bug Categorizes issue or PR as related to a bug. label Jul 11, 2019
@rhatdan
Copy link
Member

rhatdan commented Jul 11, 2019

@QiWang19 PTAL

@QiWang19
Copy link
Contributor

the issue is after extracting the tar archive, if it returns a folder has the same name with the volume, podman copies it to the containerMountpoint/volumename not the volumePath. Is it possible to fix this?

@mheon
Copy link
Member

mheon commented Jul 23, 2019

We may want to look into having podman cp join the mount namespace of the container - it would solve all these pathing gotchas...

@QiWang19
Copy link
Contributor

how to let podman cp join the mount namespace?

@github-actions
Copy link

github-actions bot commented Nov 3, 2019

This issue had no activity for 30 days. In the absence of activity or the "do-not-close" label, the issue will be automatically closed within 7 days.

@rhatdan
Copy link
Member

rhatdan commented Nov 3, 2019

@QiWang19 @jwhonce I think we talked about this a while ago, but we still have not pursued it, correct?

@mheon mheon reopened this Nov 11, 2019
@mheon
Copy link
Member

mheon commented Nov 11, 2019

I think we may want to close this one and open a tracker for a rewrite of cp

@mheon
Copy link
Member

mheon commented Nov 11, 2019

I'll leave it open until that happens, though. Better than losing it.

@jwhonce
Copy link
Member

jwhonce commented Nov 11, 2019

I thought we had a card for the rewrite but I cannot find it now. @mheon did it get deleted?

@vrothberg
Copy link
Member

Friendly ping.

@rhatdan
Copy link
Member

rhatdan commented Feb 17, 2020

@QiWang19 Any chance you can look at this?

@QiWang19
Copy link
Contributor

I had a PR to fix this by mounting the volumes but hasn't been merged for security reasons.
We have a card for rewriting the podman cp, may be this should be fixed after a new version of podman cp.https://issues.redhat.com/browse/RUN-531

@rhatdan
Copy link
Member

rhatdan commented Jun 9, 2020

@QiWang19 Could you talk to @nalind on this to see if his work on COPY can be used to fix this.

@rhatdan
Copy link
Member

rhatdan commented Sep 10, 2020

@nalind @QiWang19 Any progress?

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Oct 21, 2020

@jwhonce I think this one is needed to bubble up?

@vrothberg
Copy link
Member

@nalind, iterating on #3550 (comment): What's your take on passing a map to translate paths to the copier?

Note: copying to running containers works. The data is also copied up to the volume once a created container starts.

@nalind
Copy link
Member

nalind commented Jun 3, 2021

Rename maps are an option that the API provides, but volume are located outside of the rootfs on the host, so Put chrooting into the rootfs to write things is going to thwart efforts to solve this with that.

You could try starting Put multiple times, once per volume, with each invocation reading from a pipe, and examine each item in the stream that Get creates as it goes. You could then adjust Names and Linknames in headers read from Get, factoring in where they should end up, and feed the headers and their corresponding file contents into right Put pipe.

Hard links will complicate that, though, since it's possible that hard links would refer across rootfs/volume boundaries, and Put can't create a hard link to a file that it can't access.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jul 12, 2021

@edsantiago @vrothberg @nalind What is the latest on this one?

@edsantiago
Copy link
Member Author

Issue still present in main @ fe0bb28

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan rhatdan assigned mheon and unassigned nalind and vrothberg Aug 25, 2021
@rhatdan
Copy link
Member

rhatdan commented Aug 25, 2021

@mheon Could you look at this one?

@edsantiago
Copy link
Member Author

Still present in main @ a866a2f

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Sep 14, 2022

@flouthoc any chance to look at this?

@edsantiago edsantiago added the jetsam "...cargo that is cast overboard to lighten the load in time of distress" label Dec 8, 2022
@edsantiago
Copy link
Member Author

Abandoning. This will never get fixed.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
jetsam "...cargo that is cast overboard to lighten the load in time of distress" kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants