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}"` 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/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; 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) {