From 5aaea2fff4b6cb416f03ddc18fda8c299d303a94 Mon Sep 17 00:00:00 2001
From: Michael Jeanson <mjeanson@efficios.com>
Date: Mon, 14 Jul 2025 16:59:49 -0400
Subject: [PATCH lttng-tools] fix: test_config: user home checks $HOME first

Internally in utils_get_home_dir() the user home directory is found by
first checking the HOME environment variable and then the password
database. Modifiy test_config.py to use os.path.expanduser() which
implements the same logic instead of reading directly from the password
database.

This allows running the tests where the HOME environment variable has a
different value than the user home set in the password database.

Change-Id: I2acb10e3bbe225efbea696f9d4a1a6a5e4fe67c2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
 tests/regression/tools/config-directory/test_config.py.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/regression/tools/config-directory/test_config.py.in b/tests/regression/tools/config-directory/test_config.py.in
index 0ed537805..d0612819b 100755
--- a/tests/regression/tools/config-directory/test_config.py.in
+++ b/tests/regression/tools/config-directory/test_config.py.in
@@ -31,9 +31,10 @@ import bt2
 
 user_info = pwd.getpwuid(os.getuid())
 user_is_root = user_info.pw_uid == 0
+user_home = os.path.expanduser("~")
 
 DEFAULT_SUBSTITUTIONS = {
-    "USER_HOME": user_info.pw_dir,
+    "USER_HOME": user_home,
     "USER_ID": user_info.pw_uid,
     "SYSTEM_HOME": "@LTTNG_SYSTEM_RUNDIR@",
     "LTTNG_HOME": "@LTTNG_SYSTEM_RUNDIR@" if user_is_root else "{USER_HOME}",
-- 
2.47.2

