Re: [LTP] [PATCH v2 0/3] lib: LTP_DEBUG cleanup

Andrea Cervesato via ltp
2026-03-27T10:39:55Z

Hi Petr,

Patches 1/3 and 2/3 look good. Patch 3/3 has a regression
and a couple of nits.

> [PATCH 3/3]
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> + {"D::", "-D[1,2] Prints debug information (can be overwriten by LTP_DEBUG"},

Typo: "overwriten" -> "overwritten". Also missing closing ')'.

[...]

> case 'D':
> + if (!getenv("LTP_DEBUG")) {

This undoes the empty-string fix from patch 1/3. When
LTP_DEBUG="" is set, getenv() returns "" (non-NULL), so -D is
skipped here. But in do_setup() the tdebug_env[0] != '\0'
check also skips it. Net result: LTP_DEBUG= ./test -D2
silently produces no debug output.

Should be something like:

char *env = getenv("LTP_DEBUG");
if (!env || !env[0]) {

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com