Bug #271
closedSegmentation fault for lttng create if environment variable HOME is not set
100%
Description
In the (unlikely) case that the shell environment variable HOME is not set, a segmentation fault is created when executing the command lttng create <session name>.
I used lttng-tools version v2.0.4
Here is the information I got from the core dump:
Core was generated by `lttng create mySession'.
Program terminated with signal 11, Segmentation fault.
#0 0xb76907f1 in ?? () from /lib/libc.so.6
(gdb) backtrace
#0 0xb76907f1 in ?? () from /lib/libc.so.6
#1 0xb7690465 in strdup () from /lib/libc.so.6
#2 0x0804b98d in create_session (argc=2, argv=0xbfbbd318) at commands/create.c:97
#3 cmd_create (argc=2, argv=0xbfbbd318) at commands/create.c:193
#4 0x0805151e in handle_command (argc=3, argv=0xbfbbd314) at lttng.c:265
#5 parse_args (argc=3, argv=0xbfbbd314) at lttng.c:483
#6 main (argc=3, argv=0xbfbbd314) at lttng.c:539
In this case method call getenv("HOME") returns 0 and the sub-sequent call of strdup() causes the segmentation fault.
Best Regards
Bernd