On 2/24/26 09:22, Laine Stump via Devel wrote:
> These patches were all the result of a failed attempt to provide more
> useful error messages when libvirt is started with an insufficiently
> setup environment (e.g. $HOME isn't set and/or the XDG_* environment
> variables aren't set) which currently results in unhelpful log
> messages (for an example see
> https://issues.redhat.com/browse/RHEL-105490). The way I was trying
> to improve the log messages didn't work out the way I'd hoped (long
> story), but these patches are generally good (or, for the last two, at
> least are fodder for discussion).
>
> You can put them into 3 categories:
>
> 1) reducing the scope of some autofree strings / renaming functions
> 2) consistently use g_getenv/g_setenv
> 3) stop mocking virGetUserRuntimeDirectory in tests, and instead point
> the environment at a properly initialiazed test directory tree.
>
> (I suppose I could have sent them in separate threads, but they were
> all in a single branch so sending them together created less "local
> bureacracy")
>
> Laine Stump (8):
> util: reduce scope/autofree-ify rundir in virDaemonUnixSocketPaths()
> util: reduce scope of rundir in virPidFileConstructPath()
> remote: reduce scope of userdir in remoteGetUNIXSocketHelper()
> util: rename virGetUserDirectory(ByUID) to
> virGetUserHomeDirectory(ByUID)
> util: make completely separate functions for WIN32 versions of
> virGetUser*Directory()
> consistently use glib g_getenv() instead of libc getenv()
> tests: point $HOME and $XDG_* into usable fake root directory
> tests: stop mocking virGetUserRuntimeDirectory()
>
> scripts/rpcgen/tests/test_demo.c | 2 +-
> src/admin/libvirt-admin.c | 2 +-
> src/hyperv/hyperv_driver.c | 2 +-
> src/libvirt.c | 2 +-
> src/libvirt_private.syms | 4 +--
> src/network/leaseshelper.c | 14 ++++----
> src/qemu/qemu_command.c | 2 +-
> src/qemu/qemu_interop_config.c | 4 +--
> src/remote/remote_sockets.c | 7 ++--
> src/rpc/virnetclient.c | 4 +--
> src/rpc/virnetlibsshsession.c | 2 +-
> src/rpc/virnettlsconfig.c | 2 +-
> src/rpc/virnettlscontext.c | 2 +-
> src/util/virauth.c | 2 +-
> src/util/vircommand.c | 2 +-
> src/util/virdaemon.c | 13 ++------
> src/util/virfile.c | 4 +--
> src/util/virlease.c | 4 +--
> src/util/virlog.c | 6 ++--
> src/util/virpidfile.c | 4 +--
> src/util/virsystemd.c | 8 ++---
> src/util/virutil.c | 55 +++++++++++++++++++++----------
> src/util/virutil.h | 4 +--
> src/vbox/vbox_XPCOMCGlue.c | 2 +-
> src/vbox/vbox_common.c | 2 +-
> src/vbox/vbox_storage.c | 2 +-
> tests/eventtest.c | 2 +-
> tests/fdstreamtest.c | 2 +-
> tests/meson.build | 1 -
> tests/qemucpumock.c | 2 +-
> tests/qemuhotplugtest.c | 1 -
> tests/qemusecuritymock.c | 16 ++++-----
> tests/securityselinuxhelper.c | 10 +++---
> tests/testutils.c | 56 +++++++++++++++++++++++---------
> tests/testutils.h | 2 +-
> tests/testutilsqemu.c | 2 +-
> tests/vircgroupmock.c | 10 +++---
> tests/virfilemock.c | 8 ++---
> tests/virhostdevmock.c | 15 ---------
> tests/virhostdevtest.c | 3 +-
> tests/virmockstathelpers.c | 2 +-
> tests/virnetdaemontest.c | 2 +-
> tests/virnettlshelpers.c | 2 +-
> tests/virpcimock.c | 2 +-
> tests/virportallocatormock.c | 4 +--
> tests/virscsitest.c | 2 +-
> tests/virsystemdtest.c | 14 ++++----
> tests/virtestmock.c | 6 ++--
> tools/virsh.c | 2 +-
> tools/virt-login-shell-helper.c | 4 +--
> tools/vsh.c | 14 ++++----
> 51 files changed, 179 insertions(+), 162 deletions(-)
> delete mode 100644 tests/virhostdevmock.c
>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Michal