File: 0001-fix-test_config-user-home-checks-HOME-first.patch

package info (click to toggle)
ltt-control 2.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,860 kB
  • sloc: cpp: 192,012; sh: 28,777; ansic: 10,960; python: 7,108; makefile: 3,520; java: 109; xml: 46
file content (39 lines) | stat: -rw-r--r-- 1,589 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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