mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
Don't chown workdir if it already exists
Currently podman is always chowning the WORKDIR to root:root This PR will return if the WORKDIR already exists. Fixes: https://github.com/containers/podman/issues/9387 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -47,7 +47,7 @@ var _ = Describe("Podman run", func() {
|
||||
|
||||
It("podman run a container on an image with a workdir", func() {
|
||||
dockerfile := `FROM alpine
|
||||
RUN mkdir -p /home/foobar
|
||||
RUN mkdir -p /home/foobar /etc/foobar; chown bin:bin /etc/foobar
|
||||
WORKDIR /etc/foobar`
|
||||
podmanTest.BuildImage(dockerfile, "test", "false")
|
||||
|
||||
@ -56,6 +56,10 @@ WORKDIR /etc/foobar`
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
Expect(session.OutputToString()).To(Equal("/etc/foobar"))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "test", "ls", "-ld", "."})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.LineInOutputContains("bin")).To(BeTrue())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--workdir", "/home/foobar", "test", "pwd"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
Reference in New Issue
Block a user