From: Mathieu Desnoyers Date: Fri, 20 Oct 2023 15:57:20 +0000 (-0400) Subject: Revert "Add support for LTTNG_UST_HOME" X-Git-Url: http://git.liburcu.org/?p=lttng-ust.git;a=commitdiff_plain;h=8bc1125eb851b2c52d3263c2992e6806017e98e7 Revert "Add support for LTTNG_UST_HOME" This reverts commit 90d125c709f566f3663bf84677f100134cc618e0. After discussion with Jeremie, we want to introduce two (not one) environment variables: - LTTNG_UST_APP_PATH, - LTTNG_UST_CTL_PATH. to accomodate use-cases where a sessiond within a container is traced by a sessiond in the parent container. In that situation, we want the sessiond in the parent container to access the tracee through the LTTNG_UST_CTL_PATH, without making the unix sockets for tracing control visible to the child container. Therefore, remove the LTTNG_UST_HOME environment variable before it is added into an official release. Signed-off-by: Mathieu Desnoyers --- diff --git a/README.md b/README.md index d53f8bb5..286703ba 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -Useless change LTTng-UST ========= diff --git a/doc/man/lttng-ust.3.txt b/doc/man/lttng-ust.3.txt index 76b5c37a..0924a4de 100644 --- a/doc/man/lttng-ust.3.txt +++ b/doc/man/lttng-ust.3.txt @@ -1479,18 +1479,15 @@ int main(int argc, char* argv[]) ENVIRONMENT VARIABLES --------------------- -`LTTNG_UST_HOME`:: +`LTTNG_HOME`:: Alternative user's home directory. This variable is useful when the user running the instrumented application has a non-writable home directory. + Unix sockets used for the communication between `liblttng-ust` and the LTTng session and consumer daemons (part of the LTTng-tools project) -are located in a specific directory under `$LTTNG_UST_HOME` (or `$HOME` if -`$LTTNG_UST_HOME` is not set). - -NOTE: `$LTTNG_HOME` is also supported as a fallback of `$LTTNG_UST_HOME` for -backward compatibility reason. +are located in a specific directory under `$LTTNG_HOME` (or `$HOME` if +`$LTTNG_HOME` is not set). `LTTNG_UST_ALLOW_BLOCKING`:: If set, allow the application to retry event tracing when there's diff --git a/src/common/getenv.c b/src/common/getenv.c index 1b5717c7..55e6ad7c 100644 --- a/src/common/getenv.c +++ b/src/common/getenv.c @@ -49,7 +49,6 @@ static struct lttng_env lttng_env[] = { { "LTTNG_UST_ALLOW_BLOCKING", LTTNG_ENV_SECURE, NULL, }, { "HOME", LTTNG_ENV_SECURE, NULL, }, { "LTTNG_HOME", LTTNG_ENV_SECURE, NULL, }, - { "LTTNG_UST_HOME", LTTNG_ENV_SECURE, NULL, }, }; static diff --git a/src/lib/lttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java b/src/lib/lttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java index 2c44a0df..cb84087a 100644 --- a/src/lib/lttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java +++ b/src/lib/lttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java @@ -197,29 +197,15 @@ public class LttngTcpSessiondClient implements Runnable { private static String getHomePath() { /* - * The environment variable LTTNG_UST_HOME overrides LTTNG_HOME - * if present. * The environment variable LTTNG_HOME overrides HOME if * defined. */ - String lttngUstHomePath = System.getenv("LTTNG_UST_HOME"); - String lttngHomePath = System.getenv("LTTNG_HOME"); - - if (lttngUstHomePath != null) { - /* - * LTTNG_UST_HOME has priority over LTTNG_HOME and user - * home directory. - */ - return lttngUstHomePath; - } + String homePath = System.getenv("LTTNG_HOME"); - if (lttngHomePath != null) { - /* LTTNG_HOME has priority over user home directory. */ - return lttngHomePath; + if (homePath == null) { + homePath = System.getProperty("user.home"); } - - /* Default to the user home directory. */ - return System.getProperty("user.home"); + return homePath; } /** diff --git a/src/lib/lttng-ust/lttng-ust-comm.c b/src/lib/lttng-ust/lttng-ust-comm.c index e206456f..e57caa12 100644 --- a/src/lib/lttng-ust/lttng-ust-comm.c +++ b/src/lib/lttng-ust/lttng-ust-comm.c @@ -370,26 +370,16 @@ static char *get_map_shm(struct sock_info *sock_info); /* * Returns the HOME directory path. Caller MUST NOT free(3) the returned * pointer. - * The following env are checked in order of priority: - * 1 - LTTNG_UST_HOME - * 2 - LTTNG_HOME - * 3 - HOME */ static const char *get_lttng_home_dir(void) { const char *val; - val = (const char *) lttng_ust_getenv("LTTNG_UST_HOME"); - if (val != NULL) { - return val; - } - val = (const char *) lttng_ust_getenv("LTTNG_HOME"); if (val != NULL) { return val; } - return (const char *) lttng_ust_getenv("HOME"); } diff --git a/src/python-lttngust/lttngust/agent.py b/src/python-lttngust/lttngust/agent.py index b9929342..66dbbd5e 100644 --- a/src/python-lttngust/lttngust/agent.py +++ b/src/python-lttngust/lttngust/agent.py @@ -268,10 +268,8 @@ def _get_port_from_file(path): def _get_user_home_path(): - # $LTTNG_UST_HOME overrides $LTTNG_HOME if it exist. - # In turn, $LTTNG_HOME overrides $HOME if it exists - return os.getenv('LTTNG_UST_HOME', os.getenv('LTTNG_HOME', - os.path.expanduser('~'))) + # $LTTNG_HOME overrides $HOME if it exists + return os.getenv('LTTNG_HOME', os.path.expanduser('~')) _initialized = False