1
0
mirror of https://github.com/systemd/systemd synced 2025-09-27 15:54:47 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Luca Boccassi
f82d80da06 ansi-color: fix stack overflow with debug level and invalid SYSTEMD_COLORS env var
When SYSTEMD_COLORS is invalid, parse_systemd_colors() logs about it.
Logging helpers then call into parse_systemd_colors() to pretty-print
the log message, which then fails, so it logs about the failure,
rinse and repeat until segfault.

Follow-up for c8210d98a4b64af6fadb1cb765c0451758af1303
2025-09-12 10:58:26 +01:00
val4oss
6becea2859 mkosi conf opensuse: add libtss2-tcti-device0 dep
* Add the TPM recommended package for opensuse mkosi conf to fix the
  TEST-70-TPM failure.

Signed-off-by: val4oss <github.widget541@passmail.net>
2025-09-12 10:34:02 +01:00
Luca Boccassi
b7d3b45017 mkosi: pass through more toolchain flags 2025-09-12 10:31:32 +01:00
6 changed files with 27 additions and 17 deletions

View File

@ -14,7 +14,11 @@ PassEnvironment=
NO_BUILD
WIPE
SANITIZERS
CC
CXX
CFLAGS
CPPFLAGS
CXXFLAGS
LDFLAGS
LLVM
MESON_VERBOSE

View File

@ -57,6 +57,7 @@ Packages=
knot
libapparmor1
libcap-progs
libtss2-tcti-device0
multipath-tools
ncat
open-iscsi

View File

@ -36,10 +36,10 @@ fi
# instead. The rootfs is overlaid with a writable tmpfs during the build script so these changes don't end up
# in the image itself.
tee --append /etc/makepkg.conf >/dev/null <<EOF
export CC="$( ((LLVM)) && echo clang || echo gcc)"
export CXX="$( ((LLVM)) && echo clang++ || echo g++)"
export CC_LD="$( ((LLVM)) && echo lld)"
export CXX_LD="$( ((LLVM)) && echo lld)"
export CC="$( ((CC)) && echo "$CC" || ((LLVM)) && echo clang || echo gcc)"
export CXX="$( ((CXX)) && echo "$CXX" || ((LLVM)) && echo clang++ || echo g++)"
export CC_LD="$( ((LD)) && echo "$LD" || ((LLVM)) && echo lld)"
export CXX_LD="$( ((LD)) && echo "$LD" || ((LLVM)) && echo lld)"
export CFLAGS="\$CFLAGS $MKOSI_CFLAGS $CFLAGS"
export CXXFLAGS="\$CXXFLAGS $MKOSI_CFLAGS $CFLAGS"
export LDFLAGS="\$LDFLAGS $MKOSI_LDFLAGS $LDFLAGS"

View File

@ -67,12 +67,14 @@ DEB_BUILD_PROFILES="$(awk '$1=$1' <<<"\
")"
# TODO: Drop GENSYMBOLS_LEVEL once https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=986746 is fixed.
# Note that CXXFLAGS is for the C++ compiler, and CPPFLAGS is for the C/C++ preprocessor, they are not the same:
# https://en.wikipedia.org/wiki/CFLAGS
build() {
env \
CC="$( ((LLVM)) && echo clang || echo gcc)" \
CXX="$( ((LLVM)) && echo clang++ || echo g++)" \
CC_LD="$( ((LLVM)) && echo lld)" \
CXX_LD="$( ((LLVM)) && echo lld)" \
CC="$( ((CC)) && echo "$CC" || ((LLVM)) && echo clang || echo gcc)" \
CXX="$( ((CXX)) && echo "$CXX" || ((LLVM)) && echo clang++ || echo g++)" \
CC_LD="$( ((LD)) && echo "$LD" || ((LLVM)) && echo lld)" \
CXX_LD="$( ((LD)) && echo "$LD" || ((LLVM)) && echo lld)" \
DEB_BUILD_OPTIONS="$(awk '$1=$1' <<<"\
$( ((WITH_TESTS)) || echo nocheck) \
$( ((WITH_DOCS)) || echo nodoc) \
@ -84,6 +86,7 @@ build() {
DEB_BUILD_PROFILES="$DEB_BUILD_PROFILES" \
DEB_CFLAGS_APPEND="$MKOSI_CFLAGS $CFLAGS" \
DEB_CXXFLAGS_APPEND="$MKOSI_CFLAGS $CFLAGS" \
DEB_CPPFLAGS_APPEND="$CPPFLAGS" \
DEB_LDFLAGS_APPEND="$MKOSI_LDFLAGS $LDFLAGS" \
DPKG_FORCE="unsafe-io" \
DPKG_DEB_COMPRESSOR_TYPE="none" \

View File

@ -86,10 +86,10 @@ build() {
--unset CFLAGS \
--unset CXXFLAGS \
--unset LDFLAGS \
CC="$( ((LLVM)) && echo clang || echo gcc)" \
CXX="$( ((LLVM)) && echo clang++ || echo g++)" \
CC_LD="$( ((LLVM)) && echo lld)" \
CXX_LD="$( ((LLVM)) && echo lld)" \
CC="$( ((CC)) && echo "$CC" || ((LLVM)) && echo clang || echo gcc)" \
CXX="$( ((CXX)) && echo "$CXX" || ((LLVM)) && echo clang++ || echo g++)" \
CC_LD="$( ((LD)) && echo "$LD" || ((LLVM)) && echo lld)" \
CXX_LD="$( ((LD)) && echo "$LD" || ((LLVM)) && echo lld)" \
rpmbuild \
-bb \
--noprep \

View File

@ -36,18 +36,20 @@ void reset_ansi_feature_caches(void) {
ColorMode parse_systemd_colors(void) {
const char *e;
/* Note: do not log in this function, to avoid infinite recursion issues, as the log functions call
* this when deciding whether to color the output. */
e = getenv("SYSTEMD_COLORS");
if (!e)
return _COLOR_MODE_INVALID;
ColorMode m = color_mode_from_string(e);
if (m < 0)
return log_debug_errno(m, "Failed to parse $SYSTEMD_COLORS value '%s', ignoring: %m", e);
return m;
return color_mode_from_string(e);
}
static ColorMode get_color_mode_impl(void) {
/* Note: do not log in this function, to avoid infinite recursion issues, as the log functions call
* this when deciding whether to color the output. */
/* Returns the mode used to choose output colors. The possible modes are COLOR_OFF for no colors,
* COLOR_16 for only the base 16 ANSI colors, COLOR_256 for more colors, and COLOR_24BIT for
* unrestricted color output. */