tests: fix order of fakechroot + fakeroot nesting

As noted in the fakechroot(1) man page, fakeroot and fakechroot
might wrap the same C library functions. Arch Linux hit this
recently with calls to stat(). It is important to start the fake
environment in proper order - fakeroot should be started inside
fakechroot.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Xiretza 2023-09-17 20:26:30 +00:00 committed by Allan McRae
parent 34611a6643
commit 05f283b5ad

View file

@ -240,18 +240,20 @@ class pmtest(object):
cmd = [] cmd = []
if os.geteuid() != 0: if os.geteuid() != 0:
fakeroot = util.which("fakeroot") # fakechroot must be called before fakeroot due to potential
if not fakeroot: # potential interactions when wrapping the same C functions
tap.diag("WARNING: fakeroot not found!")
else:
cmd.append("fakeroot")
fakechroot = util.which("fakechroot") fakechroot = util.which("fakechroot")
if not fakechroot: if not fakechroot:
tap.diag("WARNING: fakechroot not found!") tap.diag("WARNING: fakechroot not found!")
else: else:
cmd.append("fakechroot") cmd.append("fakechroot")
fakeroot = util.which("fakeroot")
if not fakeroot:
tap.diag("WARNING: fakeroot not found!")
else:
cmd.append("fakeroot")
if pacman["gdb"]: if pacman["gdb"]:
cmd.extend(["libtool", "execute", "gdb", "--args"]) cmd.extend(["libtool", "execute", "gdb", "--args"])
if pacman["valgrind"]: if pacman["valgrind"]: