On Fri, Feb 16, 2018 at 06:10:02PM -0500, Shehab Elsayed wrote:
> Hi All,
> I am running into a problem when setting LTTNG_HOME and trying to save a
> session. When I do so, it always ends up saving the session to
> $HOME/.lttng/sessions instead of $LTTNG_HOME/.lttng/sessions.
> I looked at tools/src/bin/lttng-sessiond/save.c and in the save_session
> function it executes this line when there is no provided path
> char *home_dir = utils_get_user_home_dir ....
> Shouldn't it be calling utils_get_home_dir instead?
Based on the man page, you seem to be right. Jérémie might want to validate if
this was the initial intent. Overall, it would make sense to go the way you are
proposing. I'm not sure that simply swapping one for the other will do what you
expect. If I'm not mistaken utils_get_home_dir will end up saving file in the
LTTNG_HOME/HOME of the user that started the sessiond and not the
caller of the save command. Could you validate?
> When I do change the function, "lttng save" always ends up in an error
> of invalid pointer.
Keep in mind that utils_get_user_home_dir allocate a string that needs to be
freed while utils_get_home_dir does not. You might need to review the memory
handling in this function(save_session).
> Any idea why this might be happening?
Either a backtrace of lttng-sessiond or some code would have been useful here.
lttng-dev mailing list