Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 916518 - sys-apps/systemd-254.5: src/shared/install.c:444:64: error: ‘%s’ directive argument is null [-Werror=format-overflow=] with gcc 14
Summary: sys-apps/systemd-254.5: src/shared/install.c:444:64: error: ‘%s’ directive ar...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo systemd Team
URL:
Whiteboard: fixed in 255.4
Keywords:
Depends on:
Blocks: gcc-14
  Show dependency tree
 
Reported: 2023-10-30 00:13 UTC by Sam James
Modified: 2024-11-01 17:56 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (file_916518.txt,606.47 KB, text/plain)
2023-10-30 00:13 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-30 00:13:09 UTC
Created attachment 873698 [details]
build.log

I've not looked into this to see if its's a false positive or not.

FAILED: src/shared/libsystemd-shared-254.a.p/install.c.o
s390-ibm-linux-gnu-gcc -Isrc/shared/libsystemd-shared-254.a.p -Isrc/shared -I../systemd-stable-254.5/src/shared -Isrc/basic -I../systemd-stable-254.5/src/basic -Isrc/fundamental -I../systemd-stable-254.5/src/fundamental -Isrc/systemd -I../systemd-stable-254.5/src/systemd -I. -I../systemd-stable-254.5 -I../systemd-stable-254.5/src/libsystemd/sd-bus -I../systemd-stable-254.5/src/libsystemd/sd-device -I../systemd-stable-254.5/src/libsystemd/sd-event -I../systemd-stable-254.5/src/libsystemd/sd-hwdb -I../systemd-stable-254.5/src/libsystemd/sd-id128 -I../systemd-stable-254.5/src/libsystemd/sd-journal -I../systemd-stable-254.5/src/libsystemd/sd-netlink -I../systemd-stable-254.5/src/libsystemd/sd-network -I../systemd-stable-254.5/src/libsystemd/sd-resolve -I/usr/include/blkid -I/usr/include/libmount -I/usr/include/security -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -Wno-missing-field-initializers -Wno-unused-parameter -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=strict-flex-arrays -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong -fstrict-flex-arrays --param=ssp-buffer-size=4 -Wno-maybe-uninitialized -Wno-unused-result -Werror=shadow -O3 -pipe -march=native -fPIC -fno-strict-aliasing -fstrict-flex-arrays=1 -fvisibility=hidden -ffunction-sections -fdata-sections -fno-omit-frame-pointer -include config.h -pthread -fvisibility=default -MD -MQ src/shared/libsystemd-shared-254.a.p/install.c.o -MF src/shared/libsystemd-shared-254.a.p/install.c.o.d -o src/shared/libsystemd-shared-254.a.p/install.c.o -c ../systemd-stable-254.5/src/shared/install.c
In file included from ../systemd-stable-254.5/src/basic/macro.h:446,
                 from ../systemd-stable-254.5/src/basic/alloc-util.h:10,
                 from ../systemd-stable-254.5/src/shared/install.c:12:
../systemd-stable-254.5/src/shared/install.c: In function ‘install_changes_dump’:
../systemd-stable-254.5/src/shared/install.c:444:64: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  444 |                         err = log_error_errno(changes[i].type, "Failed to %s unit, unit %s does not exist.",
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../systemd-stable-254.5/src/basic/log.h:214:86: note: in definition of macro ‘log_full_errno_zerook’
  214 |                         ? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
      |                                                                                      ^~~~~~~~~~~
../systemd-stable-254.5/src/basic/log.h:254:41: note: in expansion of macro ‘log_full_errno’
  254 | #define log_error_errno(error, ...)     log_full_errno(LOG_ERR,     error, __VA_ARGS__)
      |                                         ^~~~~~~~~~~~~~
../systemd-stable-254.5/src/shared/install.c:444:31: note: in expansion of macro ‘log_error_errno’
  444 |                         err = log_error_errno(changes[i].type, "Failed to %s unit, unit %s does not exist.",
      |                               ^~~~~~~~~~~~~~~
../systemd-stable-254.5/src/shared/install.c:444:75: note: format string is defined here
  444 |                         err = log_error_errno(changes[i].type, "Failed to %s unit, unit %s does not exist.",
      |                                                                           ^~
../systemd-stable-254.5/src/shared/install.c:403:55: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  403 |                                                       "Failed to %s unit, file \"%s\" already exists.",
      |                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../systemd-stable-254.5/src/basic/log.h:214:86: note: in definition of macro ‘log_full_errno_zerook’
  214 |                         ? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
      |                                                                                      ^~~~~~~~~~~
../systemd-stable-254.5/src/basic/log.h:254:41: note: in expansion of macro ‘log_full_errno’
  254 | #define log_error_errno(error, ...)     log_full_errno(LOG_ERR,     error, __VA_ARGS__)
      |                                         ^~~~~~~~~~~~~~
../systemd-stable-254.5/src/shared/install.c:402:39: note: in expansion of macro ‘log_error_errno’
  402 |                                 err = log_error_errno(changes[i].type,
      |                                       ^~~~~~~~~~~~~~~
../systemd-stable-254.5/src/shared/install.c:403:66: note: format string is defined here
  403 |                                                       "Failed to %s unit, file \"%s\" already exists.",
      |                                                                  ^~
../systemd-stable-254.5/src/shared/install.c:399:55: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  399 |                                                       "Failed to %s unit, file \"%s\" already exists and is a symlink to \"%s\".",
      |                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../systemd-stable-254.5/src/basic/log.h:214:86: note: in definition of macro ‘log_full_errno_zerook’
  214 |                         ? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
      |                                                                                      ^~~~~~~~~~~
../systemd-stable-254.5/src/basic/log.h:254:41: note: in expansion of macro ‘log_full_errno’
  254 | #define log_error_errno(error, ...)     log_full_errno(LOG_ERR,     error, __VA_ARGS__)
      |                                         ^~~~~~~~~~~~~~
../systemd-stable-254.5/src/shared/install.c:398:39: note: in expansion of macro ‘log_error_errno’
  398 |                                 err = log_error_errno(changes[i].type,
      |                                       ^~~~~~~~~~~~~~~
../systemd-stable-254.5/src/shared/install.c:399:66: note: format string is defined here
  399 |                                                       "Failed to %s unit, file \"%s\" already exists and is a symlink to \"%s\".",
      |                                                                  ^~
../systemd-stable-254.5/src/shared/install.c:440:72: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  440 |                                 err = log_error_errno(changes[i].type, "Failed to %s unit, invalid unit reference \"%s\".",
      |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../systemd-stable-254.5/src/basic/log.h:214:86: note: in definition of macro ‘log_full_errno_zerook’
  214 |                         ? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
      |                                                                                      ^~~~~~~~~~~
../systemd-stable-254.5/src/basic/log.h:254:41: note: in expansion of macro ‘log_full_errno’
  254 | #define log_error_errno(error, ...)     log_full_errno(LOG_ERR,     error, __VA_ARGS__)
      |                                         ^~~~~~~~~~~~~~
../systemd-stable-254.5/src/shared/install.c:440:39: note: in expansion of macro ‘log_error_errno’
  440 |                                 err = log_error_errno(changes[i].type, "Failed to %s unit, invalid unit reference \"%s\".",
      |                                       ^~~~~~~~~~~~~~~
../systemd-stable-254.5/src/shared/install.c:440:83: note: format string is defined here
  440 |                                 err = log_error_errno(changes[i].type, "Failed to %s unit, invalid unit reference \"%s\".",
      |                                                                                   ^~
../systemd-stable-254.5/src/shared/install.c:437:72: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  437 |                                 err = log_error_errno(changes[i].type, "Failed to %s unit, cannot alias %s as %s.",
      |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../systemd-stable-254.5/src/basic/log.h:214:86: note: in definition of macro ‘log_full_errno_zerook’
  214 |                         ? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
      |                                                                                      ^~~~~~~~~~~
../systemd-stable-254.5/src/basic/log.h:254:41: note: in expansion of macro ‘log_full_errno’
  254 | #define log_error_errno(error, ...)     log_full_errno(LOG_ERR,     error, __VA_ARGS__)
      |                                         ^~~~~~~~~~~~~~
../systemd-stable-254.5/src/shared/install.c:437:39: note: in expansion of macro ‘log_error_errno’
  437 |                                 err = log_error_errno(changes[i].type, "Failed to %s unit, cannot alias %s as %s.",
      |                                       ^~~~~~~~~~~~~~~
../systemd-stable-254.5/src/shared/install.c:437:83: note: format string is defined here
  437 |                                 err = log_error_errno(changes[i].type, "Failed to %s unit, cannot alias %s as %s.",
      |                                                                                   ^~

----

# emerge --info
Portage 3.0.54 (python 3.11.6-final-0, default/linux/s390/17.0/systemd, gcc-14, glibc-2.38-r7, 6.0.9-gentoo s390)
=================================================================
System uname: Linux-6.0.9-gentoo-s390-8561-with-glibc2.38
KiB Mem:     5147544 total,   3426012 free
KiB Swap:    5342036 total,   5027120 free
Timestamp of repository gentoo: Sun, 29 Oct 2023 07:00:01 +0000
Head commit of repository gentoo: f11d40fc16703c16936e2a1995160ee33fe6ec75
sh bash 5.2_p15-r7
ld GNU ld (Gentoo 2.41 p2) 2.41.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p15-r7::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           3.11.6::gentoo, 3.12.0_p1::gentoo
dev-util/cmake:            3.27.7::gentoo
dev-util/meson:            1.2.3::gentoo
sys-apps/baselayout:       2.14::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-apps/systemd:          254.5::gentoo
sys-devel/autoconf:        2.71-r7::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.41-r2::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             14.0.0_pre20231022-r1::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.5-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r7::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 3
    sync-rsync-extra-opts: 

ACCEPT_KEYWORDS="s390 ~s390"
ACCEPT_LICENSE="*"
CBUILD="s390-ibm-linux-gnu"
CFLAGS="-O3 -pipe -march=native"
CHOST="s390-ibm-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -pipe -march=native"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--nospinner --ask-enter-invalid --quiet-build --keep-going --complete-graph --with-bdeps=y --load-average 2 --deep --jobs=2"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O3 -pipe -march=native"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O3 -pipe -march=native"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="acl big-endian bzip2 cli crypt dri fortran gdbm iconv ipv6 ncurses nls nptl openmp pam pcre readline s390 seccomp split-usr ssl systemd udev unicode xattr zlib" ABI_S390="32" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="void libinput" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31 ruby32" VIDEO_CARDS="dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-30 00:13:29 UTC
Needs -O3. Given bug 906161, I imagine this has been going on a while or something.
Comment 2 Mike Gilbert gentoo-dev 2023-10-30 15:08:53 UTC
There's an assert just above the relevant code that ensure a null value is not passed.
Comment 3 James Le Cuirot gentoo-dev 2023-11-19 22:19:22 UTC
I get this on m68k with GCC 13.2.1, even with -O3. Affects systemd-utils as well.
Comment 4 James Le Cuirot gentoo-dev 2023-11-19 22:22:05 UTC
Ah, I thought you meant it builds with -O3. Tried with -O2 and it worked.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-03 09:32:33 UTC
Fixed in systemd-255_rc3.
Comment 6 Larry the Git Cow gentoo-dev 2024-03-04 02:51:55 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a25cf19d6f0dd41643c17cdfebbd87fde5e0e336

commit a25cf19d6f0dd41643c17cdfebbd87fde5e0e336
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-03-04 02:50:27 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-04 02:51:32 +0000

    sys-apps/systemd: backport another stringop-truncation fix
    
    No revbump as this is a false positive (the stringop-* warnings are known
    to be noisy/flaky).
    
    Closes: https://bugs.gentoo.org/916518
    Signed-off-by: Sam James <sam@gentoo.org>

 .../files/255-install-format-overflow.patch        | 43 ++++++++++++++++++++++
 sys-apps/systemd/systemd-255.4.ebuild              |  1 +
 2 files changed, 44 insertions(+)