- Package:
- wireguard-tools
- Source:
- wireguard
- Description:
- fast, modern, secure kernel VPN tunnel (userland utilities)
- Submitter:
- Axel
- Date:
- 2022-04-24 12:42:03 UTC
- Severity:
- normal
Dear Maintainer, The wg tool outputs color on monochrome terminals, it should either default to no color output or use a proper terminal library like ncurses to output color instead of just querying if the terminal is a tty. I really don't like having to set a different environment variable to disable color output for each program which behaves like this. Kind regards, Axel
Hi, Complaining doesn't help. I've created the following patch which fixes the issue.--- terminal.c.orig 2022-04-24 13:57:34.231668500 +0200 +++ terminal.c 2022-04-24 13:57:38.519643229 +0200 @@ -24,8 +24,11 @@ mode = true; else if (var && !strcmp(var, "never")) mode = false; - else - mode = isatty(fileno(stdout)); + else { + var = getenv("TERM"); + mode = var && isatty(fileno(stdout)) && + strcmp(var + strlen(var) - 5, "color") == 0; + } return mode; } It's also attached as a patch file. Kind regards, Axel
Hi again, This patch avoids out of bounds access.--- terminal.c.orig 2022-04-24 13:57:34.231668500 +0200 +++ terminal.c 2022-04-24 14:34:35.798847083 +0200 @@ -24,8 +24,10 @@ mode = true; else if (var && !strcmp(var, "never")) mode = false; - else - mode = isatty(fileno(stdout)); + else { + var = getenv("TERM"); + mode = var && isatty(fileno(stdout)) && strstr(var, "color"); + } return mode; } Kind regards, Axel