-
Notifications
You must be signed in to change notification settings - Fork 789
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
run: use internal.GetTempDir
with os.MkdirTemp
for root and bundle path
#5084
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -499,7 +504,7 @@ func setupSlirp4netnsNetwork(config *config.Config, netns, cid string, options [ | |||
Mask: res.Subnet.Mask, | |||
}} | |||
netStatus := map[string]nettypes.StatusBlock{ | |||
slirp4netns.BinaryName: nettypes.StatusBlock{ | |||
slirp4netns.BinaryName: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gofmt
did this change and it not relevant to this PR
Ephemeral COPR build failed. @containers/packit-build please check. |
da06ca9
to
66c0f74
Compare
internal.GetTempDir
instead of os.MkdirTemp
for root and bundle pathinternal.GetTempDir
with os.MkdirTemp
for root and bundle path
66c0f74
to
0e3f189
Compare
LGTM |
Does this also need to touch call sites in image.go and sshagent.go? |
Projects which are using buildah as a library and set `TMPDIR` manually can stumble upon a use-case where `TMPDIR` was set to a relative path. Such as `export TMPDIR=.` in such case buildah will try to create a temporary root using `Mkdirtemp` leading to a point where bundle is not generated correctly since path was relative. Following use case can be resolved by making sure that buildah always converts relative path to absolute path and `GetTempDir` does it well. Example reproducer with podman ```Dockerfile FROM alpine RUN echo hello ``` ```console export TMPDIR=. podman build --no-cache -t test . ``` Expected failure ```console STEP 1/2: FROM alpine STEP 2/2: RUN echo hello error running container: checking permissions on "buildah2341274198": stat buildah2341274198: no such file or directory ERRO[0000] did not get container create message from subprocess: EOF Error: building at STEP "RUN echo hello": while running runtime: exit status 1 ``` Closes: RHEL-2598 Signed-off-by: Aditya R <[email protected]>
0e3f189
to
9c99d7c
Compare
@nalind Good point. Done. |
LGTM |
/hold |
LGTM |
/hold cancel |
Late for the review, but a very nice change @flouthoc |
Test edge-case described here: containers/buildah#5084 Test case in: RHEL-2598 Signed-off-by: Aditya R <[email protected]>
Projects which are using buildah as a library and set
TMPDIR
manually can stumble upon a use-case whereTMPDIR
was set to a relative path.Such as
export TMPDIR=.
in such case buildah will try to create a temporary root usingMkdirtemp
leading to a point where bundle is not generated correctly since path was relative.Following use case can be resolved by making sure that buildah always converts relative path to absolute path and
GetTempDir
does it well.Example reproducer with podman
Expected failure
Closes: RHEL-2598
What type of PR is this?
What this PR does / why we need it:
How to verify it
Integration test cannot be added as it can be only reproduced by projects which are using buildah as a library ( such as podman ) however reproducer for podman is given to verify the bug.
Unit test added for
GetTempDir
to make sure it is converting relative values toTMPDIR
to absoluteWhich issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?