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 export to piped command results in Error: open /dev/stdout: permission denied #16870

Closed
lancew-q opened this issue Dec 16, 2022 · 7 comments · Fixed by #16888
Closed
Assignees
Labels
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. macos MacOS (OSX) related

Comments

@lancew-q
Copy link

lancew-q commented Dec 16, 2022

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Steps to reproduce the issue:

  1. podman export container-name | tar -C container-fs -xv

Describe the results you received:

Error: open /dev/stdout: permission denied

Describe the results you expected:
Container export contents should pipe to the following command without error, and export contents should present at the specified location

Additional information you deem important (e.g. issue happens only occasionally):

It appears that this is a bug similar to: #12402

That issue was fixed by changing the call from os.Create to os.OpenFile with the correct flags. Likely this issue is fixed with a similar fix to: https://github.com/containers/podman/blob/main/pkg/domain/infra/tunnel/containers.go#L363

Output of podman version:

Client:       Podman Engine
Version:      4.3.1
API Version:  4.3.1
Go Version:   go1.18.8
Built:        Wed Nov  9 13:43:58 2022
OS/Arch:      darwin/arm64

Server:       Podman Engine
Version:      4.3.1
API Version:  4.3.1
Go Version:   go1.19.2
Built:        Fri Nov 11 08:00:31 2022
OS/Arch:      linux/arm64```

**Output of `podman info`:**


**Package info (e.g. output of `rpm -q podman` or `apt list podman` or `brew info podman`):**

**Have you tested with the latest version of Podman and have you checked [the Podman Troubleshooting Guide](https://github.com/containers/podman/blob/main/troubleshooting.md)?**

Yes/No

**Additional environment details (AWS, VirtualBox, physical, etc.):**
@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 16, 2022
@github-actions github-actions bot added the macos MacOS (OSX) related label Dec 16, 2022
@rhatdan
Copy link
Member

rhatdan commented Dec 17, 2022

Have you tried this against the main branch?

@rhatdan
Copy link
Member

rhatdan commented Dec 17, 2022

When I execute your command I get

podman export f6 | tar -C container-fs xv
tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options
Try 'tar --help' or 'tar --usage' for more information.

I get the same with Docker?

docker export d3 | tar -C container-fs xv -Acdtrux

tar: You may not specify more than one '-Acdtrux', '--delete' or '--test-label' optio

@Luap99
Copy link
Member

Luap99 commented Dec 19, 2022

Why do we need to open the file at all? We should just use fd 1 without having to call open.

@lancew-q
Copy link
Author

@rhatdan command typed might be bad, might need - in front of xv args, e.g. podman export f6 | tar -C container-fs -xv

@Luap99 My uninformed guess, usually this command is used like this podman export container-name -o path-to-tar.tar, so sometimes it is passed an actual file location.

@Luap99
Copy link
Member

Luap99 commented Dec 19, 2022

@Luap99 My uninformed guess, usually this command is used like this podman export container-name -o path-to-tar.tar, so sometimes it is passed an actual file location.

Sure but if we have /dev/stderr as path we can skip the open call since it is already open as fd 1.

@Luap99 Luap99 self-assigned this Dec 19, 2022
Luap99 added a commit to Luap99/libpod that referenced this issue Dec 20, 2022
This allows use to use STDOUT directly without having to call open
again, also this makes the export API endpoint much more performant
since it no longer needs to copy to a temp file.
I noticed that there was no export API test so I added one.

And lastly opening /dev/stdout will not work on windows.

Fixes containers#16870

Signed-off-by: Paul Holzinger <[email protected]>
@brad-jones
Copy link

Any idea when this fix will be released? Or are there daily builds of podman somewhere? For Windows?
I just hit this issue with podman export foo | wsl --import foo bar -
Anyway, I guess I'll create a temp file for now :(

@rhatdan
Copy link
Member

rhatdan commented Jan 10, 2023

We are cutting RC1 of Podman 4.4 this week. So it should be released by end of month or early next month.
If you are working on a MAC you might need to wait a couple of more weeks for the package to show up in Fedora CoreOS via Podman machine.

@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 4, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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. macos MacOS (OSX) related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants