From e447f9ac0b7911e7f094f8300f61807bdcf06c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 5 May 2022 19:49:26 +0200 Subject: [PATCH 1/3] docs/RELEASE: typo in target name --- docs/RELEASE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RELEASE.md b/docs/RELEASE.md index 4a1f394aee..acbfa8e5bb 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -11,7 +11,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later 2. Update the contributors list in NEWS (`ninja -C build git-contrib`) 3. Update the time and place in NEWS 4. Update hwdb (`ninja -C build update-hwdb`, `ninja -C build update-hwdb-autosuspend`, commit separately). -5. Update syscall numbers (`ninja -C build update-syscall-tables update-syscall-headers`). +5. Update syscall numbers (`ninja -C build update-syscall-tables update-syscall-header`). 6. [RC1] Update version and library numbers in `meson.build` 7. Check dbus docs with `ninja -C build update-dbus-docs` 8. Tag the release: `version=vXXX-rcY && git tag -s "${version}" -m "systemd ${version}"` From 34c2d32cf97ddc41348960687e52db6637faf1df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 6 May 2022 18:19:21 +0200 Subject: [PATCH 2/3] shared/terminal-util: don't use $COLORTERM to force colors Fixup for a5efbf468c96190c9562bc8121eda32310dfd112: if $COLORTERM was set, we'd unconditionally turn on colors, which is unexpected and wrong. It even breaks our own tests when executed in gnome-terminal. --- src/basic/terminal-util.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index 8ddcfe2323..a142ba2dfb 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -1278,12 +1278,7 @@ ColorMode get_color_mode(void) { /* We only check for the presence of the variable; value is ignored. */ cached_color_mode = COLOR_OFF; - else if (STRPTR_IN_SET(getenv("COLORTERM"), - "truecolor", - "24bit")) - cached_color_mode = COLOR_24BIT; - - else if (getpid_cached() == 1) + else if (getpid_cached() == 1) { /* PID1 outputs to the console without holding it open all the time. * * Note that the Linux console can only display 16 colors. We still enable 256 color @@ -1292,9 +1287,23 @@ ColorMode get_color_mode(void) { * map them to the closest color in the 16 color palette (since kernel 3.16). Doing * 256 colors is nice for people who invoke systemd in a container or via a serial * link or such, and use a true 256 color terminal to do so. */ - cached_color_mode = getenv_terminal_is_dumb() ? COLOR_OFF : COLOR_256; - else - cached_color_mode = terminal_is_dumb() ? COLOR_OFF : COLOR_256; + if (getenv_terminal_is_dumb()) + cached_color_mode = COLOR_OFF; + } else { + if (terminal_is_dumb()) + cached_color_mode = COLOR_OFF; + } + + if (cached_color_mode < 0) { + /* We failed to figure out any reason to *disable* colors. + * Let's see how many colors we shall use. */ + if (STRPTR_IN_SET(getenv("COLORTERM"), + "truecolor", + "24bit")) + cached_color_mode = COLOR_24BIT; + else + cached_color_mode = COLOR_256; + } } return cached_color_mode; From b38a9d2d77c680fb7ae9b6fb6faf9ab4fe9fc555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 6 May 2022 18:23:06 +0200 Subject: [PATCH 3/3] basic/strv: fix splitting of strings with escape characters Plain strv_split() should not care if the strings contains backslashes or quote characters. But extract_first_word() interprets backslashes unless EXTRACT_RETAIN_ESCAPE is given. I wonder how it's possible that nobody noticed this before. I think this code was introduced in 0645b83a40d1c782f173c4d8440ab2fc82a75006. --- src/basic/strv.h | 2 +- src/test/test-strv.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/basic/strv.h b/src/basic/strv.h index 6295058876..b9563e8692 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -77,7 +77,7 @@ int strv_split_full(char ***t, const char *s, const char *separators, ExtractFla static inline char** strv_split(const char *s, const char *separators) { char **ret; - if (strv_split_full(&ret, s, separators, 0) < 0) + if (strv_split_full(&ret, s, separators, EXTRACT_RETAIN_ESCAPE) < 0) return NULL; return ret; diff --git a/src/test/test-strv.c b/src/test/test-strv.c index dabb0cd973..331c277c35 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -317,6 +317,21 @@ TEST(strv_split) { assert_se(strv_split_full(&l, "\\", NULL, EXTRACT_UNQUOTE | EXTRACT_RELAX | EXTRACT_UNESCAPE_RELAX) == 1); assert_se(strv_equal(l, STRV_MAKE("\\"))); + + l = strv_free_erase(l); + + assert_se(l = strv_split("\\", NULL)); + assert_se(strv_equal(l, STRV_MAKE("\\"))); + + l = strv_free_erase(l); + + assert_se(l = strv_split("aa\\ bb\\", NULL)); + assert_se(strv_equal(l, STRV_MAKE("aa\\", "bb\\"))); + + l = strv_free_erase(l); + + assert_se(l = strv_split("aa\" bb'", NULL)); + assert_se(strv_equal(l, STRV_MAKE("aa\"", "bb'"))); } TEST(strv_split_empty) {