From: Lennart Poettering Date: Fri, 16 Jan 2026 21:29:40 +0000 (+0100) Subject: string-util: accept ":" when stripping ANSI color sequences X-Git-Tag: v260-rc1~376^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e09b5366e57cbe06c32a7607236e1383a2e4d533;p=thirdparty%2Fsystemd.git string-util: accept ":" when stripping ANSI color sequences Since 6eabe9f2ff48c1b6924724d5afe64e7b661ccdbf we generate sequences with ":", hence we better also know how to strip them. (Without this patch we'd strip simple ANSI colors, but not RGB ones that use ":" syntax). (While we are at it, also drop a duplicate "0" in the list of valid chars) --- diff --git a/src/basic/string-util.c b/src/basic/string-util.c index 0c5c0a62872..ecd0277577d 100644 --- a/src/basic/string-util.c +++ b/src/basic/string-util.c @@ -735,7 +735,7 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) { case STATE_CSI: assert(n_carriage_returns == 0); - if (eot || !strchr("01234567890;m", *i)) { /* EOT or invalid chars in sequence */ + if (eot || !strchr(DIGITS ";:m", *i)) { /* EOT or invalid chars in sequence */ fputc('\x1B', f); fputc('[', f); advance_offsets(i - *ibuf, highlight, shift, 2);