When I run autopkgtest using sbuild on my own machine, I sometimes get warnings or breakages because certain environment variables are either
unset or have "broken" values, whereas I see that on ci.debian.net and
the buildds, the builds run without problem.
It would be really useful to be able to set up my local sbuild
environment in the same way as the Debian machines (buildd and
ci.debian.net) for testing purposes.
HOME (pointing to where?)
LC_ALL (or something similar; what is its setting?)
and XDG_RUNTIME_DIR
On Thu, 28 Apr 2022 at 08:33:02 +0100, Julian Gilbey wrote:
When I run autopkgtest using sbuild on my own machine, I sometimes get warnings or breakages because certain environment variables are either unset or have "broken" values, whereas I see that on ci.debian.net and
the buildds, the builds run without problem.
What autopkgtest backend are you using? (autopkgtest-virt-schroot? autopkgtest-virt-qemu? ...) There are several, and their behaviour can be very different, depending on the level of isolation they provide.
Having a concrete example of the command-line and configuration you use,
and a package that has warnings or breakage in this configuration, would
be useful.
ci.debian.net currently uses autopkgtest-virt-lxc via the debci package.
HOME (pointing to where?)
sbuild
------
There is no guarantee about $HOME while a Debian package is being built. Policy §4.9 [0] says it is a bug for the build process of a package to
write into the real $HOME.
debhelper compat levels >= 13 set a temporary $HOME for the duration
of the build, to make it easier for packages to comply with the Policy
§4.9 requirement.
autopkgtest
-----------
According to the autopkgtest spec[1],
Tests can expect that the $HOME environment variable to be set to
a directory that exists and is writeable by the user running the test.
Depending on backend, that directory might be your real home directory,
or it might be a transient/expendable home directory that it is OK for
the test to damage. It would probably be good to have a restriction[2]
that has the effect of guaranteeing that an expendable home directory
is used, as it is in autopkgtest-virt-qemu.
LC_ALL (or something similar; what is its setting?)
LC_ALL is not normally set on "real" Debian systems. Usually, only $LANG
and $LANGUAGE are set, even on a full desktop system (for example my GNOME desktop has LANG=en_GB.utf8 and LANGUAGE=en_GB:en, but no LC_ALL).
LC_ALL is intended to be the "big hammer" that overrides everything else.
and XDG_RUNTIME_DIR
[...]
sbuild does whatever schroot does. If I remember correctly, schroot
currently inherits XDG_RUNTIME_DIR from the host system, [...]
debhelper compat levels >= 13 set a temporary $XDG_RUNTIME_DIR for the duration of `dh_auto_test`, and unset it at all other times, to make it easier for packages to comply with the Policy §4.9 requirement.
On Thu, Apr 28, 2022 at 10:16:30AM +0100, Simon McVittie wrote:
According to the autopkgtest spec[1],
Tests can expect that the $HOME environment variable to be set to
a directory that exists and is writeable by the user running the test.
That's interesting; I don't find any code that sets HOME in
autopkgtest.
Now I understand that better, it seems that changing the autopkgtest
spec to say something more like the following, if it's true:
The HOME environment variable is inherited from the calling
process. It is up to the container manager to ensure that this
directory exists and is writeable by the user running the test.
(Incidentally, given that
typically XDG_RUNTIME_DIR is in the ephemeral /run filesystem, writing
to it would not violate policy 4.9.)
I wonder whether autopkgtest
could consider setting up a temporary directory for this purpose like dh_auto_test does, rather than using the heavy machinery of
libpam-systemd?
Making the test script set up a mock XDG_RUNTIME_DIR and a mock
session bus would be a less useful test, because that only proves that gnome-keyring can work if you set up a mock environment by hand, and says nothing about whether gnome-keyring genuinely works on a normal system.
That's interesting; I don't find any code that sets HOME in
autopkgtest.
The purpose of autopkgtest is to run the tests in a realistic environment that resembles a real Debian desktop or server, but it doesn't know much about how the testbed system is set up, so it relies on the virtualization backend or the testbed itself to set HOME appropriately. Ideally, it
should be logging into a fully-working Debian system (perhaps under qemu
or lxc, or even on real hardware via ssh) and running tests there.
As I said on #986665, this seems like either a bug in autopkgtest-virt-schroot, or misconfiguration in how you and Laurent
are configuring it (the schroot profile that you're telling it to use).
On Thu, 28 Apr 2022 at 14:02:46 +0100, Julian Gilbey wrote:
On Thu, Apr 28, 2022 at 10:16:30AM +0100, Simon McVittie wrote:
According to the autopkgtest spec[1],
Tests can expect that the $HOME environment variable to be set to
a directory that exists and is writeable by the user running the test.
That's interesting; I don't find any code that sets HOME in
autopkgtest.
The purpose of autopkgtest is to run the tests in a realistic environment that resembles a real Debian desktop or server, but it doesn't know much about how the testbed system is set up, so it relies on the virtualization backend or the testbed itself to set HOME appropriately. Ideally, it
should be logging into a fully-working Debian system (perhaps under qemu
or lxc, or even on real hardware via ssh) and running tests there.
As I said on #986665, this seems like either a bug in autopkgtest-virt-schroot, or misconfiguration in how you and Laurent
are configuring it (the schroot profile that you're telling it to use).
[...]
(Incidentally, given that
typically XDG_RUNTIME_DIR is in the ephemeral /run filesystem, writing
to it would not violate policy 4.9.)
Policy §4.9 says that "Required targets must not attempt to write outside
of the unpacked source package tree", then makes a few exceptions for locations like /tmp. /run is not one of those locations, so writing to
/run is not allowed.
I wonder whether autopkgtest
could consider setting up a temporary directory for this purpose like dh_auto_test does, rather than using the heavy machinery of
libpam-systemd?
No, I don't think it should. The purpose of autopkgtest is to run the
[...]
Does that mean that autopkgtests that directly or indirectly use the dbus-run-session tool to setup a temporary D-Bus session are buggy?
The other thing is testing graphical tools; should that be done in a
mock X11/Wayland session (using xvfb-run), or a real desktop session?
So can I suggest that
sbuild-setup(7) explains this a bit more and discusses setting up a meaningful HOME directory?
And perhaps has the things necessary for a
meaningful XDG_RUNTIME_DIR set up by default as well?
On Fri, 29 Apr 2022 at 08:34:48 +0100, Julian Gilbey wrote:
So can I suggest that
sbuild-setup(7) explains this a bit more and discusses setting up a meaningful HOME directory?
I'm sure patches are accepted, but the problem with this is that what you want for sbuild does not match what you want for autopkgtest. For sbuild,
the environment that most closely resembles our real, production buildds involves the /etc/schroot/buildd profile, and a uid whose home directory
is /nonexistent. For autopkgtest, one of the more permissive profiles
like /etc/schroot/desktop is more realistic, and tests are allowed to
assume that they run as a user with a real home directory.
I would personally recommend one of the better-isolated autopkgtest
backends like -lxc or -qemu for running autopkgtest tests. -qemu doesn't
need root, and there are proposed patches adding backends that use unprivileged user namespaces (-unshare and Podman), which I should
probably be reviewing instead of replying to this email.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 05:11:38 |
Calls: | 10,386 |
Calls today: | 1 |
Files: | 14,058 |
Messages: | 6,416,629 |