test/e2e: fix podman run with noexec for ubuntu 26.04

Test case bind mounts host's /bin to /hostbin and tries to exec
/hostbin/ls, and expects a particular exit code.

It does not work on Ubuntu 26.04 because it ships with coreutils-rs
by default, in which:

	/bin/ls -> ../lib/cargo/bin/coreutils/ls

and so we get ENOENT instead of EPERM.

Fix by replacing ls with true. The funny thing is, it's also a symlink
on Ubuntu 26.04:

	/bin/true -> gnutrue

but it works since the destination is in the same directory.

(NOTE the whole test relies on the fact that the kernel checks
permissions first -- a dynamic binary from a different distro
won't be able to run anyway.)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2026-10-01 11:26:01 -07:00
parent ccc1e20775
commit 9a2c84b130

View file

@ -373,7 +373,7 @@ var _ = Describe("Podman run with volumes", func() {
})
It("podman run with noexec can't exec", func() {
session := podmanTest.Podman([]string{"run", "--rm", "-v", "/bin:/hostbin:noexec", ALPINE, "/hostbin/ls", "/"})
session := podmanTest.Podman([]string{"run", "--rm", "-v", "/bin:/hostbin:noexec", ALPINE, "/hostbin/true"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError(126, "ermission denied"))
})