On Thu, 7 Nov 2024 at 11:58, Stefan Berger <stef...@linux.ibm.com> wrote: > > > > On 11/7/24 6:09 AM, Peter Maydell wrote: > > On Wed, 6 Nov 2024 at 18:08, Stefan Berger <stef...@linux.vnet.ibm.com> > > wrote: > >> > >> From: Stefan Berger <stef...@linux.ibm.com> > >> > >> To avoid AppArmor-related test failures when functional test are run from > >> somewhere under /mnt, adjust the path to swtpm's state to use an AppArmor- > >> supported path, such as /var/tmp, which is provided by the python function > >> tempfile.TemporaryDirectory(). > >> > >> An update to swtpm's AppArmor profile is also being done to support > >> /var/tmp. > >> > >> Link: > >> https://lore.kernel.org/qemu-devel/CAFEAcA8A=kwlttz+nua-mpzqkaejw5sroyzruzne2tb6vmo...@mail.gmail.com/ > >> Link: https://github.com/stefanberger/swtpm/pull/944 > >> Signed-off-by: Stefan Berger <stef...@linux.ibm.com> > > > > Thanks for writing this patch. I can confirm that the test now > > runs OK on my Ubuntu setup, so > > That's good to hear. However, it surprises me because the tests probably > use /var/tmp/ as temp dir and that's no supported in the AppArmor > profile yet.
On my machine the temporary directory that tempfile.TemporaryDirectory() creates is under /tmp/. This matches what the Python docs say: https://docs.python.org/3/library/tempfile.html#tempfile.gettempdir where if you haven't set TMPDIR, TEMP or TMP then you get /tmp/ (assuming it exists; you get /var/tmp if it doesn't). thanks -- PMM